Hi Nitin,

Please check the documentation and verify that you registered your mapping
driver correctly.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 12 July 2014 15:50, Nitin Singh <[email protected]> wrote:

> Hi Marco,
>
> I am new PHP user and trying to create a zend 2 demo application with
> doctrine odm.
> I have followed  read me
> https://github.com/doctrine/DoctrineMongoODMModule
> I tried to use a document class with notation
> <?php
> namespace Enterprise\Model;
> use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
> /**
>  * @ODM\Document(collection = "enterprises")
>  */
> class Enterprise{
>       /**
>      * @ODM\Id
>      */
>     private $id;
>     /**
>      *
>      * @var string
>      * @ODM\String
>      */
>     private $name;
>     /**
>      *
>      * @var string
>      * @ODM\String
>      */
>     private $address;
> }
> but I am also getting the same MappingException
>
> The class 'Enterprise\Model\Enterprise' was not found in the chain configured 
> namespaces
>
> I guess I need to add the mapping for Document Path and driver class in
> drivers section module.doctrine-mongo-odm.local.php.
>  could you please kindly help me out telling me the further steps.
>
> regards,
> Nitin
>
>
> On Thursday, June 20, 2013 6:31:02 PM UTC+5:30, mbneto wrote:
>
>> Hi Marco,
>>
>> Thanks for the reply.  I can check but if the Drivers that you've mention
>> is the conf as describe at https://github.com/doctrine/
>> DoctrineMongoODMModule then yes.
>>
>> I can use from the controller like the example below. btw which property
>> do you refer as the " dump the class metadata factory"?  do a var_dump
>> of the DocumentManager is kind of big.
>>
>> public function indexAction()    {        $dm = 
>> $this->getServiceLocator()->get('doctrine.documentmanager.odm_default');     
>>    $user = new \MyNamespace\Model\User();        $user->setName('mario');
>>         $dm->persist($user);        $dm->flush();
>>
>> }
>>
>>
>>
>> On Thu, Jun 20, 2013 at 3:59 AM, Marco Pivetta <[email protected]> wrote:
>>
>>> I'd actually check your application's config first, and see if the
>>> namespaces for your drivers are actually there.
>>>
>>> You can also dump the class metadata factory of the ODM and see what is
>>> going on in there.
>>>
>>> Marco Pivetta
>>>
>>> http://twitter.com/Ocramius
>>>
>>> http://ocramius.github.com/
>>>
>>>
>>> On 20 June 2013 04:47, mbneto <[email protected]> wrote:
>>>
>>>>  Hi,
>>>>
>>>> I am using DoctrinODM with my zf2 project and from the application
>>>> itself (ex. controllers) I can access and manipulate the entities without a
>>>> problem.
>>>>
>>>> When I try to call it from the phpunit tests I get error but I don't
>>>> know where else should I configure the chain.   In the tests I load the
>>>> document manager without a problem using
>>>>
>>>> $this->getApplicationServiceLocator()->get('doctrine.
>>>> documentmanager.odm_default');
>>>>
>>>> 1) MyNamespace\User\MongoOdmDaoTest::testFindByIdShouldReturn
>>>> Doctrine\Common\Persistence\Mapping\MappingException: The class
>>>> 'MyNamespace\Model\User' was not found in the chain configured namespaces
>>>>
>>>> myapp/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/
>>>> MappingException.php:38
>>>> myapp/vendor/doctrine/common/lib/Doctrine/Common/
>>>> Persistence/Mapping/Driver/MappingDriverChain.php:114
>>>> myapp/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/
>>>> Mapping/ClassMetadataFactory.php:152
>>>>  myapp/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/
>>>> AbstractClassMetadataFactory.php:308
>>>> myapp/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/
>>>> AbstractClassMetadataFactory.php:205
>>>> myapp/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/
>>>> DocumentManager.php:287
>>>> myapp/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/
>>>> UnitOfWork.php:1753
>>>> myapp/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/
>>>> DocumentManager.php:393
>>>> myapp/module/MyNamespace/tests/MyNamespaceTest/
>>>> Fixtures/User/MongoOdmDao.php:43
>>>> myapp/vendor/doctrine/data-fixtures/lib/Doctrine/Common/
>>>> DataFixtures/Executor/AbstractExecutor.php:120
>>>> myapp/vendor/doctrine/data-fixtures/lib/Doctrine/Common/
>>>> DataFixtures/Executor/MongoDBExecutor.php:81
>>>> myapp/module/MyNamespace/tests/MyNamespaceTest/User/
>>>> MongoOdmDaoTest.php:40
>>>>
>>>> - Thanks
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "doctrine-user" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>>
>>>> Visit this group at http://groups.google.com/group/doctrine-user.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "doctrine-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>>
>>> Visit this group at http://groups.google.com/group/doctrine-user.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to