Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReflectionException when (de)serializing unless fully qualified classname is used #1045

Closed
andig opened this issue Feb 24, 2019 · 1 comment

Comments

@andig
Copy link
Contributor

andig commented Feb 24, 2019

Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? no

Trying to unserialize a JSON structure and hitting:

Fatal error: Uncaught ReflectionException: Class SearchDashboardsAndFolders does not exist in /Users/andig/htdocs/grafana-serializer/vendor/jms/metadata/src/MetadataFactory.php:170

The same happens when serializing. It seems that for de/serialization to work, type annotations need to use the fully qualified classname as in:

namespace Andig\GrafanaSerializer\Model;

use JMS\Serializer\Annotation\Type;

class Dashboard
{
    /**
     * @Type("array<Andig\GrafanaSerializer\Model\Panel>")
     */
    public $panels;
}

It is not sufficient to use the short version although the class exists in the namespace:

    /**
     * @Type("array<Panel>")
     */
    public $panels;

Is this the expected behaviour?

@andig andig changed the title ReflectionException: ReflectionException when deserializing Feb 24, 2019
@andig andig changed the title ReflectionException when deserializing ReflectionException when (de)serializing Feb 24, 2019
@andig andig changed the title ReflectionException when (de)serializing ReflectionException when (de)serializing unless fully qualified classname is used Feb 24, 2019
@andig
Copy link
Contributor Author

andig commented Feb 24, 2019

I guess I just have to accept that the class names must be fully qualified...

@andig andig closed this as completed Feb 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant