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

    I have a model A that has a many-to-one relationship with model B.

    So model A has the class variable "var $belongs_to = array("b");" and I can access the object B via object A. But only the row associated in B to A.
    The B available in A is an instance of AkAssociatedRecord where I need functionality of AkActiveRecord/ActiveRecord (for findFirst).

    What I would like to be able to do is do a findFirst("code = ?", $code) on B to retrieve a "default" B. When the object A is first created it must point to a default B and not be NULL.

    Is there a way I can achieve this?

    Kind regards,

    John
    •  
      CommentAuthorjulio montoya
     

    maybe with AK::import('modelname');

    • CommentAuthorJCC
     
    Thanks Julio, that seems to be what I was looking for!

    John
    • CommentAuthorManoj
     
    Thanks Julio