Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorsuthern
     

    I just thought I'd pass this on for anyone else having trouble. If you intend to use an 'include' option in a find, AND use conditions like 'tablename.id = 3', you will notice that an error occurs about an incorrect column name. If you remove the 'include' statement, the error vanishes. If you turn on debugging ($this->CONTROLLER->dbug();), You should be able to see where the problem lies.

    I'll save you the time. ;-) When you put in the 'include' option, the SQL statement changes whatever the original table's name was, into __owner.

    • CommentAuthorThijs
     

    Yes, I also noticed it. In the SQL query is then stated:

    ... FROM primaryTable AS __owner LEFT OUTER JOIN secondaryTable ...
    

    (primaryTable being the original table name, and secondaryTable the associated table)

    • CommentAuthorThijs
     

    Noticed one more thing:

    FROM primaryTable AS __owner LEFT OUTER JOIN secondaryTable AS _secondaryTable
    

    So if you want to use a condition on a field in the associated table you'll have to prefix it with an underscore.

    Like, f.i. :

    $this->primaryModel->find($this->params['id'], array('include' => 'associatedModel','conditions' => "_associatedModel.field = 2"));
    

    Well.. It's probably not the preferred way of doing a find like that.. but it works.

    • CommentAuthorKaste
     

    see my comment here

    submit a ticket, will you?