JMS序列化KNP paginator bundle的分页数据

时间:2014-04-04 12:16:11

标签: symfony solr jmsserializerbundle knppaginator

您好我在我的REST API中使用以下捆绑包。

 "jms/serializer-bundle" : "0.13.0", /// for serialization
 "nelmio/solarium-bundle" : "2.0.4",// solarium bundle for integration with solr bundle
 "knplabs/knp-paginator-bundle" : "2.4.0", // for pagination code

现在当我尝试使用jms序列化为sql查询序列化数据时,它运行正常,但是当我使用solr作为后端并尝试反序列化这些数据时,我得到了以下错误。

用于序列化的mycode:

$pagination = $paginator->paginate(array($productSearchServices->getSearchClient(), $selectQuery),
                $this->get('request')->query->get('page', 1)/*page number*/,
                $this->get('request')->query->get('per_page', 10)/*limit per page*/
            );

            echo $serializer->serialize($pagination, 'json');die;

Resources are not supported in serialized data. Path: Monolog\Handler\StreamHandler -> Symfony\Bridge\Monolog\Logger -> Nelmio\SolariumBundle\Logger -> Symfony\Component\EventDispatcher\EventDispatcher -> Solarium\Client -> Solarium\QueryType\Select\Result\Result -> Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination

下面是堆栈跟踪

 in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 137  +
at GraphNavigator ->accept (resource, null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 140  +
at GenericSerializationVisitor ->visitProperty (object(PropertyMetadata), object(StreamHandler), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 227  +
at GraphNavigator ->accept (object(StreamHandler), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 102  +
at GenericSerializationVisitor ->visitArray (array(object(DebugHandler), object(StreamHandler), object(ConsoleHandler)), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php at line 55  +
at JsonSerializationVisitor ->visitArray (array(object(DebugHandler), object(StreamHandler), object(ConsoleHandler)), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 129  +
at GraphNavigator ->accept (array(object(DebugHandler), object(StreamHandler), object(ConsoleHandler)), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 140  +
at GenericSerializationVisitor ->visitProperty (object(PropertyMetadata), object(Logger), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 227  +
at GraphNavigator ->accept (object(Logger), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 140  +
at GenericSerializationVisitor ->visitProperty (object(PropertyMetadata), object(Logger), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 227  +
at GraphNavigator ->accept (object(Logger), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 102  +
at GenericSerializationVisitor ->visitArray (array(object(Logger), 'preExecuteRequest'), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php at line 55  +
at JsonSerializationVisitor ->visitArray (array(object(Logger), 'preExecuteRequest'), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 129  +
at GraphNavigator ->accept (array(object(Logger), 'preExecuteRequest'), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 102  +
at GenericSerializationVisitor ->visitArray (array(array(object(Logger), 'preExecuteRequest')), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php at line 55  +
at JsonSerializationVisitor ->visitArray (array(array(object(Logger), 'preExecuteRequest')), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 129  +
at GraphNavigator ->accept (array(array(object(Logger), 'preExecuteRequest')), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 102  +
at GenericSerializationVisitor ->visitArray (array(array(array(object(Logger), 'preExecuteRequest'))), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php at line 55  +
at JsonSerializationVisitor ->visitArray (array(array(array(object(Logger), 'preExecuteRequest'))), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 129  +
at GraphNavigator ->accept (array(array(array(object(Logger), 'preExecuteRequest'))), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 102  +
at GenericSerializationVisitor ->visitArray (array('solarium.core.preExecuteRequest' => array(array(array(object(Logger), 'preExecuteRequest'))), 'solarium.core.postExecuteRequest' => array(array(array(object(Logger), 'postExecuteRequest')))), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php at line 55  +
at JsonSerializationVisitor ->visitArray (array('solarium.core.preExecuteRequest' => array(array(array(object(Logger), 'preExecuteRequest'))), 'solarium.core.postExecuteRequest' => array(array(array(object(Logger), 'postExecuteRequest')))), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 129  +
at GraphNavigator ->accept (array('solarium.core.preExecuteRequest' => array(array(array(object(Logger), 'preExecuteRequest'))), 'solarium.core.postExecuteRequest' => array(array(array(object(Logger), 'postExecuteRequest')))), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 140  +
at GenericSerializationVisitor ->visitProperty (object(PropertyMetadata), object(EventDispatcher), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 227  +
at GraphNavigator ->accept (object(EventDispatcher), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 140  +
at GenericSerializationVisitor ->visitProperty (object(PropertyMetadata), object(Client), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 227  +
at GraphNavigator ->accept (object(Client), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 140  +
at GenericSerializationVisitor ->visitProperty (object(PropertyMetadata), object(Result), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 227  +
at GraphNavigator ->accept (object(Result), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 102  +
at GenericSerializationVisitor ->visitArray (array('result' => object(Result)), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php at line 55  +
at JsonSerializationVisitor ->visitArray (array('result' => object(Result)), array('name' => 'array', 'params' => array()), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 129  +
at GraphNavigator ->accept (array('result' => object(Result)), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GenericSerializationVisitor.php at line 140  +
at GenericSerializationVisitor ->visitProperty (object(PropertyMetadata), object(SlidingPagination), object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/GraphNavigator.php at line 227  +
at GraphNavigator ->accept (object(SlidingPagination), null, object(SerializationContext))
in /var/www/API/vendor/jms/serializer/src/JMS/Serializer/Serializer.php at line 91  +
at Serializer ->serialize (object(SlidingPagination), 'json')
in /var/www/API/src/OfficeBrain/Bundle/SearchEngineBundle/Controller/DefaultController.php at line 118  +
at DefaultController ->searchProductAction ()
at call_user_func_array (array(object(DefaultController), 'searchProductAction'), array())
in kernel.root_dir/bootstrap.php.cache at line 2911  +
at HttpKernel ->handleRaw (object(Request), '1')
in kernel.root_dir/bootstrap.php.cache at line 2883  +
at HttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/bootstrap.php.cache at line 3022  +
at ContainerAwareHttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/bootstrap.php.cache at line 2303  +
at Kernel ->handle (object(Request))
in /var/www/API/web/app_dev.php at line 29  +

0 个答案:

没有答案