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

    I'm trying to understand which variable to use then.
    E.g. a book has one author. So the BookController has (among others) 2 members:
    author
    and
    Author

    What is the meaning of those 2? When to use which?
    It looks like that for a new book (isNewRecord returns true), both are of type AkAssociatedRecord, but for an existing book both are of type Author.
    Unfortunately the find method for both classes is different: For AkAssociatedRecord it will return the associated author, but for Author it will return an array with all authors in the database. So I have to be careful which function to call in which context and that's why I'm confused.


    Christoph
    • CommentAuthorpogeybait4883
     

    In a controller some magic happens when you have associations with models. A variable, in your case $author, is created and refers to a specific instance of the Author class. the $Author variable refers to the class in general.