Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthordelia
     
    are nested includes implemented in Akelos yet?
    • CommentAuthorjan.bartos
     
    Good question, I am looking for the nested includes in Akelos too...
    • CommentAuthordemaio
     

    I think, nested includes can be easily replaced by including your own libraries in the application controller or custom controller files;] Custom libraries can be placed in lib folder of your application (which you will have to create yourself first);

    Regards Demaio

    • CommentAuthorjan.bartos
     
    Could you provide some example please? ActiveRecord provides quite sophisticated infrastructure which I would like to reuse and implementing nested includes gives more sense to me than reinventing the wheel and creating own ad-hoc solution.
    • CommentAuthorjan.bartos
     
    I came to quick and dirty workaround. Example:

    model:
    member - belongsTo user,item
    item - belongsTo expedition

    problem:
    I retrieve members in controller using find() command and for each member I want to display name of related expedition. And I want to do that in single sql query to enable sorting members according to expedition name.

    solution:
    Apply attached patch for belongsTo relationship (just change its extension back to .patch), modify member model: member - belongsTo user,item,expedition
    and in controller load related expeditions using

    $options['column_dictionary'] = array('expedition_name' => '_expedition.name');
    $options['include'] = array('user','item','expedition'=>array(
    'joins'=>'LEFT OUTER JOIN expeditions AS _expedition ON _item.expedition_id = _expedition.id '));
    $this->members =& $this->Member->find('all', $options);

    'column_dictionary' option is used to make creation of sortable link in table header possible.