ZF-Commons/ZfcUserDoctrineORM

No identifier/primary key specified for Entity "ZfcUserDoctrineORM\Entity\User" sub class of "ZfcUser\Entity\User". Every Entity must have an identifier/primary key.

Opened this issue · 12 comments

Hi Evan,
When accessing /user by login or register :

No identifier/primary key specified for Entity "ZfcUserDoctrineORM\Entity\User" sub class of "ZfcUser\Entity\User". Every Entity must have an identifier/primary key.

David

Hmm, I'm not sure why you'd get this... best I can tell, there is a primary key.

Interesting. Not sure what the issue is directly. Maybe @Ocramius can help?

Maybe this issue is relative to pk name "user_id".
Each of my pk are named "id" to avoid problems ;-)

You can call the PK as you wish. Did you change something in the entities/mappings? What are the operations you are executing? Do you have a stack trace?

The problem appears when i copy module.config.php (https://github.com/ZF-Commons/ZfcUserDoctrineORM/blob/master/config/module.config.php) into my autoload directory and rename this file to zfcuserdoctrineorm.global.php without changing anything. If i don't copy this file, everything works fine.

File:

N:\DEV\APPLICATIONS\rencontres\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\MappingException.php:38

Message:

No identifier/primary key specified for Entity "ZfcUserDoctrineORM\Entity\User" sub class of "ZfcUser\Entity\User". Every Entity must have an identifier/primary key.

Stack trace:

#0 vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataInfo.php(887): Doctrine\ORM\Mapping\MappingException::identifierRequired('ZfcUserDoctrine...')
#1 vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php(187): Doctrine\ORM\Mapping\ClassMetadataInfo->validateIdentifier()
#2 vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php(170): Doctrine\ORM\Mapping\ClassMetadataFactory->validateRuntimeMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL)
#3 vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php(302): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL, false, Array)
#4 vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php(205): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('ZfcUserDoctrine...')
#5 vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php(268): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('ZfcUserDoctrine...')
#6 vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php(621): Doctrine\ORM\EntityManager->getClassMetadata('ZfcUserDoctrine...')
#7 vendor\zf-commons\zfc-user-doctrine-orm\src\ZfcUserDoctrineORM\Mapper\User.php(30): Doctrine\ORM\EntityManager->getRepository('ZfcUserDoctrine...')
#8 vendor\zf-commons\zfc-user\src\ZfcUser\Validator\AbstractRecord.php(104): ZfcUserDoctrineORM\Mapper\User->findByEmail('true5@true5.com')
#9 vendor\zf-commons\zfc-user\src\ZfcUser\Validator\NoRecordExists.php(12): ZfcUser\Validator\AbstractRecord->query('true5@true5.com')
#10 vendor\zendframework\zendframework\library\Zend\Validator\ValidatorChain.php(187): ZfcUser\Validator\NoRecordExists->isValid('true5@true5.com', Array)
#11 vendor\zendframework\zendframework\library\Zend\InputFilter\Input.php(151): Zend\Validator\ValidatorChain->isValid('true5@true5.com', Array)
#12 vendor\zendframework\zendframework\library\Zend\InputFilter\BaseInputFilter.php(182): Zend\InputFilter\Input->isValid(Array)
#13 vendor\zendframework\zendframework\library\Zend\Form\Form.php(377): Zend\InputFilter\BaseInputFilter->isValid()
#14 vendor\zf-commons\zfc-user\src\ZfcUser\Service\User.php(63): Zend\Form\Form->isValid()
#15 vendor\zf-commons\zfc-user\src\ZfcUser\Controller\UserController.php(157): ZfcUser\Service\User->register(Array)
#16 vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php(150): ZfcUser\Controller\UserController->registerAction()
#17 [internal function]: Zend\Mvc\Controller\AbstractActionController->execute(Object(Zend\Mvc\MvcEvent))
#18 vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(465): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#19 vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#20 vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php(117): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#21 vendor\zendframework\zendframework\library\Zend\Mvc\DispatchListener.php(151): Zend\Mvc\Controller\AbstractActionController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#22 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#23 vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(465): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#24 vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#25 vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(317): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))

Well, looks like metadata for the parent class isn't loaded correctly...

Hi,

I have the same problem but for different reasons, in the case of @booradleys he is overriding the paths key with the wrong directory, but in my case is due to changes in DoctrineModule\Service\DriverFactory(doctrine/DoctrineModule@2991130#L13L86), the extension is not checked anymore and the default value in the configuration of the module is null, for now I have added the extension key to my configuration

'zfcuser_entity' => array(              
    'extension' => '.dcm.xml'
)

sorry about my english guys

regards,

Pablo

@masterpuppet my bad, guess I should put a default value or throw an exception in the DriverOptions. Please let me know on DoctrineModule

Hey @ALL,
after install actual version (today) via composer i get the Primary-Key Error during usage of zfc-user-doctrine-orm

No identifier/primary key specified for Entity 'ZfcUserDoctrineORM\Entity\User'. Every Entity must have an identifier/primary key.

During usage of last version (Beta5 from last week) i could overwrite installd zf-common elements with actual downloadable version and it works. But this is not a solution :) . So my favourite way is to use only composer, but i get the "primary key error". Hope anyone can help me. Thanks a lot

mludewig

Same error here with clear install. Both cli and http backends

Hey hoochie,
solved the problem with adding the "minimum-stability": "dev", statement in composer.json. but i think its only a solution for the moment.

yeah, I found exact this solution independently. But anyway, thank you.