symfony - Doctrine Associations Mapping -


For the first time, I am trying for ideological associations with Symfony2 and it is giving me a headache.

I is an Admin Interface, which can upload images in addition to other things. I want to know which administrator has uploaded any image, so I have put my admin in my images table, gather data, gather data To do a simple JOIN is necessary, but with the principle, I am stuck, but it seems simple.

Therefore, I have a statement in that object, that I have a administrator object that reflects the table ...

  @ ORM \ OneToMany (target = "ImageBundleNamespace \ ImageEntity", mapped = "admin")  

It's easy in my ImageEntity object (which is Images indicates table) a foreigh key column admin .

In the ImageEntity object, I use this statement ...

  @ORM \ ManyToOne (targetEntity = "AdministratorNamespace \ Administrator", inversedBy = "imageEntity")  ImageEntity  and   

admin > ImageEntity field contains the implied Statement Mapping

This does not work

I have the SchemaValidator And it says that Administrator area ImageEntity ob Do not crop tells defined second message as an association that admin field does not exist.

If this helps, then for all of this it is my DQL ...

  'Selection i.id, i.imeSlike, i.velicina, i Image bundle from .ekstenzija, i.paths, a.username, a.ime, a.prezime: one in Image I Admin a ' 

Thanks in advance for all help.

Edit

I had a mistake in DQL. Corrected it.

Edit

I forgot to add source code to the administrator part ...

  ** * @ORM \ OneToMany (targetEntity = "Icoo \ Administracija \ GalerijaBundle \ Entity \ ImageEntity", mapped = "administrator") * * / protected $ imageEntity; Public function __ composition () {$ this- & gt; ImageEntity = new ArrayCollection (); }  

Association Part of ImageEntity

  / ** * @ORM \ column (type = "small") * * @ORM \ ManyToOne (targetEntity = "Icoo \ LoginBundle \ Entity \ Administrator", inversedBy = "imageEntity") * @ORM \ JoinColumn (name = "admin", referenced column name = "id") * * / $ protected admin;  

In the administrator category, you have:

   

P> Let me know all this.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -