Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorOmeZ
     
    My actions:
    - I created model "Post" and added column "comments_count", set $hasMany='comments';
    - I created model "Comment" and set $belongsTo=array('post'=>array('counter_cache'=>true));

    but when I create comments counter doesn't change in posts, what I have done wrong?
    •  
      CommentAuthorbermi
     

    Have you verified if each comment hasErrors()?, many times things don't get stored due to side validation failures, so checking hasErrors() and getErrors() is useful.

    You should also know that you can see generated SQL (including COMMITs and ROLLBACKS) by calling $Model->dbug()

    • CommentAuthorThijs
     

    Oops.

    I tried to use the counter_cache with the latest trunk (trying out Kastes' changes), but got a PHP error:

    Fatal error: Call to undefined method AkAssociatedActiveRecord::incrementCounter() in /Users/thijs/akelos_framework/lib/AkActiveRecord/AkAssociations/AkBelongsTo.php on line 183

    Maybe a mistype, the incrementCounter() function being in another lib file?

    In the former trunk I didn't have this error, but I couldn't get counter_cache to work using it.

    • CommentAuthorKaste
     

    AFAIK counter_cache is not implemented?. I don't like the error though. unit-test?

    • CommentAuthordanfreak
     
    Anyone any news about this issue?

    Dan
    • CommentAuthorThijs
     

    @Danfreak: Kaste just re-factored ActiveRecord.. so he should know.

    @Kaste: okay, I'll unit-test it (it's on my list for march.. will be be my first test. never did it)