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

    I am trying to associate my post model with comments model by writing

    var $has_many = 'comments';
    

    in posts model.

    Now, when I write $this->Post->find($id); it only fetches the post for the given id and not the comments for that post. I saw the query and its only

    SELECT * FROM posts WHERE posts.id = 1 LIMIT 1
    

    No join condition in the above query.

    •  
      CommentAuthoradityamooley
     

    After debugging more into this I found that I have to pass the associated class name to the find() function. But now its giving following error message:

    Fatal error: Class 'Comment' not found in /home/****/akelos/lib/AkActiveRecord/AkHasMany.php on line 617
    

    Looks like the comment model file is not getting included before instantiation. The line causing this error is:

    $ModelInstance =& new $class_name();
    

    in file AkHasMany.php

    •  
      CommentAuthoradityamooley
     

    OK. Fixed the problem. I added a line

    require_once(AKInflector::toModelFilename($class_name));
    

    or more appropriately

    Ak::import($class_name);
    

    just above

    $ModelInstance =& new $class_name();
    

    in file AkHasMany.php

    I have submitted a patch for this file