我按照https://github.com/doctrine/DoctrineModule/blob/1.0.x/docs/hydrator.md中的说明操作
但是指令$hydrator = new DoctrineHydrator( $objectManager );
不起作用:
ReflexionExeption
档案:/Users/joseribeiro/Sites/zendoct2/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php:73
Class does not exist.
控制器:
namespace Product\Controller;
use DoctrineORMModule\Paginator\Adapter\DoctrinePaginator as DoctrineAdapter;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;
...
public function editAction()
{
$objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
$hydrator = new DoctrineHydrator( $objectManager );
...
}
我的module.config.php
'doctrine' => array(
'driver' => array(
__NAMESPACE__ . '_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
),
'orm_default' => array(
'drivers' => array(
__NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
)
)
)
)
错误日志:
[Tue Aug 27 12:56:27 2013] [error] [client 127.0.0.1] PHP Warning: Missing argument 2 for DoctrineModule\\Stdlib\\Hydrator\\DoctrineObject::__construct(), called in .../module/Product/src/Product/Controller/ProductController.php on line 90 and defined in .../vendor/doctrine/doctrine-module/src/DoctrineModule/Stdlib/Hydrator/DoctrineObject.php on line 71
[Tue Aug 27 12:56:27 2013] [error] [client 127.0.0.1] PHP Notice: Undefined variable: targetClass in .../vendor/doctrine/doctrine-module/src/DoctrineModule/Stdlib/Hydrator/DoctrineObject.php on line 76
[Tue Aug 27 12:56:27 2013] [error] [client 127.0.0.1] PHP Warning: class_parents(): object or string expected in /Users/joseribeiro/Sites/zendoct2/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php on line 40
[Tue Aug 27 12:56:27 2013] [error] [client 127.0.0.1] PHP Warning: array_reverse() expects parameter 1 to be array, boolean given in .../vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php on line 257
[Tue Aug 27 12:56:27 2013] [error] [client 127.0.0.1] PHP Warning: Invalid argument supplied for foreach() in .../vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php on line 257
我不明白有什么不对!