JMSSerializerBundle:从未导入 属性 Doctrine\ORM\Mapping\GeneratedValue::$strategy 中的注释“@Enum”
JMSSerializerBundle: the annotation '@Enum' in property Doctrine\ORM\Mapping\GeneratedValue::$strategy was never imported
我遇到了这个错误:
The annotation '@Enum' in property
Doctrine\ORM\Mapping\GeneratedValue::$strategy was never imported. Did
you maybe forget to add a 'use' statement for this annotation?
我只是想序列化一个分页器对象:
$paginator = new Paginator($query, $fetchJoinCollection = true);
$serializer = \JMS\Serializer\SerializerBuilder::create()->build();
$jsonContent = $serializer->serialize($paginator, 'json');
这些是我安装的 composer.json 个软件包:
doctrine/annotations v1.2.3 Docblock Annotations Parser
doctrine/cache v1.4.0 Caching library offering an objec...
doctrine/collections v1.2 Collections Abstraction library
doctrine/common v2.4.2 Common Library for Doctrine projects
doctrine/dbal v2.5.1 Database Abstraction Layer
doctrine/doctrine-bundle v1.3.0 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle v1.0.1 Symfony2 Bundle for Doctrine Cache
doctrine/doctrine-migrations-bundle dev-master 81575a4 Symfony DoctrineMigrationsBundle
doctrine/inflector v1.0.1 Common String Manipulations with ...
doctrine/lexer v1.0.1 Base library for a lexer that can...
doctrine/migrations dev-master 96f838b Database Schema migrations using ...
doctrine/orm v2.4.7 Object-Relational-Mapper for PHP
gedmo/doctrine-extensions v2.3.9 Doctrine2 behavioral extensions
stof/doctrine-extensions-bundle dev-master 2ff8473 Integration of the gedmo/doctrine...
这是 JMSSerializer 的 Github 页面上的一个话题:https://github.com/schmittjoh/JMSSerializerBundle/issues/380
将非实体结果传递给 Serializer 可能会产生此类错误。
基本上,您不应该将分页器传递给序列化程序,而应该传递分页器执行结果,因为序列化程序不知道如何处理 Paginator
。
我遇到了这个错误:
The annotation '@Enum' in property Doctrine\ORM\Mapping\GeneratedValue::$strategy was never imported. Did you maybe forget to add a 'use' statement for this annotation?
我只是想序列化一个分页器对象:
$paginator = new Paginator($query, $fetchJoinCollection = true);
$serializer = \JMS\Serializer\SerializerBuilder::create()->build();
$jsonContent = $serializer->serialize($paginator, 'json');
这些是我安装的 composer.json 个软件包:
doctrine/annotations v1.2.3 Docblock Annotations Parser
doctrine/cache v1.4.0 Caching library offering an objec...
doctrine/collections v1.2 Collections Abstraction library
doctrine/common v2.4.2 Common Library for Doctrine projects
doctrine/dbal v2.5.1 Database Abstraction Layer
doctrine/doctrine-bundle v1.3.0 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle v1.0.1 Symfony2 Bundle for Doctrine Cache
doctrine/doctrine-migrations-bundle dev-master 81575a4 Symfony DoctrineMigrationsBundle
doctrine/inflector v1.0.1 Common String Manipulations with ...
doctrine/lexer v1.0.1 Base library for a lexer that can...
doctrine/migrations dev-master 96f838b Database Schema migrations using ...
doctrine/orm v2.4.7 Object-Relational-Mapper for PHP
gedmo/doctrine-extensions v2.3.9 Doctrine2 behavioral extensions
stof/doctrine-extensions-bundle dev-master 2ff8473 Integration of the gedmo/doctrine...
这是 JMSSerializer 的 Github 页面上的一个话题:https://github.com/schmittjoh/JMSSerializerBundle/issues/380
将非实体结果传递给 Serializer 可能会产生此类错误。
基本上,您不应该将分页器传递给序列化程序,而应该传递分页器执行结果,因为序列化程序不知道如何处理 Paginator
。