Michal Charemza wrote:
Hi,

What's a good way using Doctrine Records / Tables with Agavi Models? I feel 
using Agavi Models to then just call methods in its associated Doctrine Record 
/ Table seems a bit, strange...

Michal.
_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users
This depends entirely on how you organize your application. For example, some of my model code is like this:

function initialize(...)
{
    $this->orm_target = 'Widgets';
}

protected function getTable() // in base class
{
   return Doctrine::getTable($this->orm_target);
}

function getMyWidgets()
{
     $us = $this->context->getUser();
return $this->getTable()->findAllByOwnerId($us->getAttribute('owner_id'))
}

function buildHurrDurrReport($month)
{
     $rows = Doctrine_Query::create()->
                    ....
                    leftJoin(...) ->
                    ....
                    execute(array($month))->toArray();

    foreach ($rows as $k=>$v)
    {
        $result[] = ....

    }

    return $result;
}

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to