-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?

0

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.