-2

I'm working with Symfony3, and at one point I need to get the class name from an entity object.

I have two tables: role and tier. Both have only two fields: id and name. If I do a query to get these entities, one comes back as a regular entity (as is expected), but the other comes back as a proxy, and I can't understand why.

Tier is a foreign key and belongs to another table, but in this instance I'm only getting the tiers, so I don't see why this should matter.

Can anyone explain how or if there is anything I can do in this scenario?

Chewy
  • 196
  • 1
  • 12

1 Answers1

1

Its normal that you have proxy. Doctrine use the lazy loading to load entities. I advice you to read this answer:

stackoverflow.com/a/17787070/2377164

Anyway you should be able to use your "proxy" as an entity. Doctrine will load the data you need when you'll try to get some properties

Community
  • 1
  • 1
olibiaz
  • 2,551
  • 4
  • 29
  • 31
  • I understand that proxies themselves are fine, my question is why I'm receiving one in one case, but not the other. More specifically, I am getting an autoload error when I try to instantiate the proxy (new Proxy\__CG__\.......()). Could this be a permissions issue? – Chewy Mar 03 '16 at 14:05