Hello.
Is there a way to get a related model when I'm in a controller?
What I mean is doing something like this:

Suppose I have an Author model and a Book model and an author has many 
books.
I would like to do something like this:

class BookController {
  public function view($id) {
    $book = $this->Book->findById($id);
    $author = $book->getAuthor();
  }
}

I can't find a way to do this. I know other frameworks which can do it like 
Rails or Propel and it seems strange Cake can't do it.
For example, in Rails I can do

book = author.find(params[:id])
author = book.author

Thank you very much in advance!
Andrés

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to