views:

97

answers:

2

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?

A: 

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

kuba
A: 

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.

Timo
i just profiled the "magic" way of accessing the objects data. and it does cost A LOT of time - if you call around 120000 getter.
Mo.sch
In this case should use array fetching if you have to work with this amount of data.
Timo