Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorhpatoio
    • CommentTimeMay 6th 2008
     
    Is find_by_sql working ?

    I've tried but I get

    > Fatal error: Call to undefined method Topic::find_by_sql() in ...

    Is this feature going to be released ?

    --
    Simone
    • CommentAuthorKaste
    • CommentTimeMay 6th 2008
     

    thats findBySql in Akelos.

    most functions are camelCased

    • CommentAuthorhpatoio
    • CommentTimeMay 7th 2008
     

    Thank. found the function but I don't get the expected results

    if my controller I have :

    function myTest() { $this->topics =& $this->Topic->findBySql("SELECT T.id, T.title, count(*) as feeds_number FROM topics AS T INNER JOIN feeds as F ON T.id = F.topic_id GROUP BY id, title"); }

    then in the view

    {loop topics} Title: {topic.title} n topics : {topic.feeds_number} {end}

    the point is that topics do not have feeds_number property.

    I had a fast look at findBySql and it seems that getOnlyAvailableAttributes returns the table attibutes and not those in the SQL.

    Am I wrong or is this a bug ?

    -- Simone

    • CommentAuthorKaste
    • CommentTimeMay 7th 2008
     

    You're right.

    • CommentAuthorhpatoio
    • CommentTimeMay 8th 2008
     

    Ok, that's already something.

    I'm trying to fix this.

    Actually I taught that was enough to replace

    $objects[] =& $this->instantiate($this->getOnlyAvailableAttributes($record), false);

    with

    $objects[] =& $this->instantiate($record, false);

    But it doesn't work.

    In the AkActiveRecord constructor I get the correct parameters, but the object is still created just with those of the table.

    Hints ?

    -- Simone

    • CommentAuthorKaste
    • CommentTimeMay 8th 2008
     

    ->setAttributes filters unknown attributes. (not columns nor so called combined attributes)

Add your comments
    Username Password
  • Format comments as