Custom Collections in Doctrine 1.2

I am using Doctrine 1.2. I would like to execute Doctrine_Query, which instead of returning Doctrine_Collection will return the class of my choice. That is, something like

$o = Doctrine_Query::create()
->from('Foo')
->execute();

$o; //instance of Doctrine_Collection

usually returns a common Doctrine_Collection object. Instead, I would like it to return a Foo_Collection object, which I define elsewhere

class Foo_Collection extends Doctrine_Collection
{

    public function soSomethingSpecificToAFooObject()
    {
    }
}

which will allow me to logically group functionality.

Is it possible? From my reading and popping the codebase, this seems to be related to hydrators, but I could not find the manual or manual page that covers what I want.

+3
source share
1 answer

, setUp construct ( construct setUp, ):

$this->_table->setAttribute(Doctrine_Core::ATTR_COLLECTION_CLASS, 'Foo_Collection');

Doctrine_Connection, Doctrine_Collection .

+4

Source: https://habr.com/ru/post/1778938/


All Articles