Doctrinebundle: Avoid Entities

Created on 15 Feb 2018  Â·  9Comments  Â·  Source: doctrine/DoctrineBundle

Is it not possible to avoid generating or creating getters and setters for columns that do not have to be modified?

It really doesn't make any sense to create getters or setters that are not going to be modified in the final result. I think this option would be very useful.

All 9 comments

Entity generator and surrounding facilities have been deprecated and removed from the next ORM major release, and they will not be improved.

https://github.com/doctrine/doctrine2/pull/6870

I was also speaking in terms of ORM, that is, because writing in the entity.php if you are not going to make modified results(set and get), by default the ORM should have it. And ORM is to improve this type of situation, to make you write something that is not going to be modified is prehistoric.
Thanks anyway.

@chiqui3d at this point in time, the ORM core team is unanimous about the opinion that entities should not be generated, but designed.

Even read-only objects need that (typical example: lookup read-only tables).

I don't understand how doctrine does it automatically for setID and not for the other columns, it's primitive.

I just created 50 column and I have to go one by one writing setColumn() and getColumn(), I'm not saying that they are generated, I say Doctrine knows that if in the entity there is no getColumn or a setColumn, Doctrine use one in its default.

@chiqui3d doctrine does never touch the public API of your methods: it uses reflection to set/get data from your objects.

doctrine does never touch the public API of your methods: it uses reflection to set/get data from your objects.

@Ocramius this behaviour should me mentioned in docs (if it hasn't been there already) this is not obvious and a lot of people are asking for this

Can you maybe send a patch to the documentation? Would be great to get an
explanation about it in
https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/working-with-objects.html#working-with-objects

On Fri, 8 Jun 2018, 08:03 Jarek Jakubowski, notifications@github.com
wrote:

@Ocramius https://github.com/Ocramius this behaviour should me
mentioned in docs (if it hasn't been there already) this is not obvious and
a lot of people are asking for this

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/DoctrineBundle/issues/778#issuecomment-395647908,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakPosWqQVX6lf0q2ltYwKkvuuaXOmks5t6gWrgaJpZM4SGaTt
.

Thanks @JarJak!

Was this page helpful?
0 / 5 - 0 ratings