Question

I'm looking for a way to let Doctrine generate getters and setters for me, because otherwise it will call the Doctrine_Record "get" method which costs a lot of time.

so is there a chance to do that?

Was it helpful?

Solution

It seems that this functionality was removed some time ago: http://trac.doctrine-project.org/ticket/1188

However, someone prepared a patch for you: http://coolsoft.altervista.org/en/blog/2009/03/how-make-symfonydoctrine-generate-accessors

OTHER TIPS

That's not how Doctrine works and as kuba wrote the feature was removed from Doctrine (there were reasons to do so). The current stable version relies heavily on magic functions. Accessing the fields via the magic getters and setter like Doctrine is doing it does not cost that much time. There are other parts of doctrine that are much more time consuming. So if you have performance issues with doctrine you should "attack" that "problem" by using array results for your query (i.e. fetchArray instead of execute). That's saving a lot of time and memory. If you need objects you can hydrate the array data to an object as needed.

The creation of getter and setter is some kind of micro-optimization that will may cause you a lot of trouble. If I were you I would keep going the standard way of Doctrine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top