Sunday, 15 May 2011

php - Error when persisting an embedded document with DoctrineMongoDB : array given -


I am working on a project, which uses Principle-Mongo DB and Symphony.

I have a document here:

Music Inc:

East> & lt ;? Php // app / resources / documents / music.fp namespace AppBundle \ Document; Use the principle \ ODM \ MongoDB \ Mapping \ Annotations as the Mangaodbi; / ** * @MongoDB \ document (collection = "BV_MUSC_INFOs") * / class musicInfos {/ ** * @MongoDB \ Id (strategy = "auto") * / protected $ id; / ** * @MongoDB \ ReferenceOne (targetDocument = "user") * / protected $ user; / ** * @MongoDB \ EmbedMany (targetDocument = "InstrumentsPlayed") * / protected $ instruments = array ();

More embedded documents:

  & lt; Php namespace AppBundle \ Document; Use the principle \ ODM \ MongoDB \ Mapping \ Annotations as the Mangaodbi; / ** * Mongodebi \ embedded document * / class instrument plated {/ ** * @MongoDB \ ReferenceOne (target document = "tool") * / protected $ tool; / ** * @MongoDB \ Field (type = "int") * / protected $ practiceLevel;  

After this I have created a form to fill out those documents:

   

Controller

   Tie ($ request); If ($ form-> isValid ()) {$ user = $ this- & gt; Container-> Get ('security.context') - & gt; GetToken () - & gt; GetUser (); $ MusicalInfos- & gt; SetUser ($ user); $ Dm-> Continues ($ musicalInfos); $ Dm-> Flush (); $ Response = new JasonRespons (); $ Response- & gt; Setdata (array ('registred_musical' = & gt; true)); $ Refund; }  

But when I try this, I always get the exception: Warning: spl_object_hash () expects parameter 1 to be an object,

I do not know why ...

Thank you for your help!


No comments:

Post a Comment