Hi Mike,
Welcome to the Akelos forums!
Associated records need to be loaded implicitly in Akelos, so in your previous console example you'll need to do something like
$a = new Author(1);
$booklist = $a->book->load();
Ak::debug($booklist);
Including associations can be done easily by adding the include option in the finder like in this controller example
function listing(){
$this->Authors = $this->Author->find('all', array('include' => 'books'));
}
and then this Sintags in the view
{loop Authors.books}
<p>book.id {book.id}</p>
<p>book.title {book.title}</p>
{end}
And regarding you last question, to close Akelos console you just need to type
exit
I hope you find it useful :D
Mike,
Assigning variables like this
{books = author.books}
is not implemented yet in Sintags. You could have used plain PHP for that like
<? $books = $author->books ?>
but it is not necessary to assign that var as SIntags loops can take author.books as a parameter like this
{loop authors}
<%= link_to author.name, :action => 'show', :id => author.id %>
{loop author.books}
<%= link_to book.title, :controller => 'books', :action => 'show', :id => book.id %>
{end}
{end}
Regarding, formatting on the forum, you can select Format comments as Markdown and indent code with 4 spaces.
I'm not getting any books displayed.
'$author->books'
is apparently not finding any of the books
I changed : empty($author->books) ? null : $books_available = count($author->books); to empty($author->books) ? $books_available = 0 : $books_available = count($author->books); echo "
<
p> books_available = ",$books_available;
and am getting " books_available = 0"
I also tried : $booksload = $author->books->load(); echo "
<
p> $booksload = ",$booksload;
and am getting Fatal error: Call to a member function load() on a non-object in D:\xampplite\htdocs\akelos\app\views\author\compiled\listing1.tpl.php on line 64
which looks to me to be related to the other message I posted about getting an error message for the error I was getting in the console for the :
$booklist = $a->book->load();
statement.
Mike
1 to 6 of 6