Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthormsalhab
     
    How can I access authors name for a book ?

    in logic its $book->author->name?

    but i have got an error saying not defined "name".
    • CommentAuthorThijs
     

    in logic its $book->author->name?

    yes! or even shorter, in sintags:

    {book.author.name}
    

    But the authors' names need to be loaded. So you'll have to include the model in the find in your controller:

    $this->books =& $this->Book->find('all', array('include' => 'author'));
    

    Or if you're dealing with the detail page of a book: (an 'edit' or 'show' action)

    $this->book->author->load();