dont put echo debug($this->Book->Author->find('all')); just into
class controller - you need to put in some function (for exampplne
into index fuction)
2010/3/12 Mónico Briseño :
> Hi, all. Paul, I did your suggestion. I got the following:
>
>
> class BooksController extends AppController {
> e
You don't need the echo - just debug() will suffice.
Jeremy Burns
jeremybu...@me.com
On 12 Mar 2010, at 15:54, Mónico Briseño wrote:
> Hi, all. Paul, I did your suggestion. I got the following:
>
>
> class BooksController extends AppController {
> echo debug($this->Book->Author->find('all'))
Hi, all. Paul, I did your suggestion. I got the following:
Book->Author->find('all'));
}
?>
Output
*Parse error*: syntax error, unexpected T_STRING, expecting T_FUNCTION in *
/var/www/relationship/app/controllers/books_controller.php* on line *3*
Cheers
--
M.S. Mónico Briseño Cortés
Instru
That data array shows that Cake is not trying to pull data from the
Author model as there should be at the very least an empty [0][Author]
array. This means cake is not seeing your association for some
reason.
However, this is a very simple association, which it appears you have
defined correctly
Martin. I got it. Thanks.
This is the output of debug($books)
Array
(
[0] => Array
(
[Book] => Array
(
[id] => 3
[isbn] => 123456789
[title] => C programming
[description] => C
in index.ctp try to write
or at least - print_r($books); - so we will know, is in fields - array
2010/3/11 Mónico Briseño :
> Paul, Structure of two tables
>
> CREATE TABLE `authors` (
> `id` int( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
> `name` varchar( 127 ) NOT NULL ,
> `email`
Paul, Structure of two tables
CREATE TABLE `authors` (
`id` int( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` varchar( 127 ) NOT NULL ,
`email` varchar( 127 ) NOT NULL ,
`website` varchar( 127 ) NOT NULL
);
CREATE TABLE `books` (
`id` int( 11 ) NOT NULL AUTO_INCREMEN
@monico can you show us what the echo debug($books); outputs and the
structure of your two tables?
HTH
Paul
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
yeah, debug yout $book variable is good point (or just use print_r($book))
even that, i still think problem is Author - Name (acording to the
your error log ...)
2010/3/10 WebbedIT :
> Before you move to your view, make sure your controller is sending the
> right data to the view.
>
> In your con
Hi, all. Thanks Paul, for your time to help me in this ORM stuff. No authors
in Book find command.
Models
Controllers
Author->recursive = 1;
$authors = $this->Author->find('all');
$this->set('authors', $authors);
}
}
?>
Book->recursive = 1;
$bo
Before you move to your view, make sure your controller is sending the
right data to the view.
In your controller run your find
$books = $this->Book->find('all');
Then debug the results to make sure you are getting your Authors
echo debug($books);
If you are not then you need to look at why yo
> Undefined index: Author [APP/views/books/index.ctp, line 9]
problem line :
>
i think, problem is in parsed array - you are trying to echo something
that not exist - in array
($book['Author'] dosnt exist or $book['Author']['name'] dosnt exist )
2010/3/9 monicob :
> Hi, all. I have the foll
Hi, all. I have the following problem with ORM:
I'm learning to use it. I create two tables: books and author, two
models, two controllers, two HTML files. However, when I run books
index.ctp
I got the following error message:
Undefined index: Author [APP/views/books/index.ctp, line 9]
--inde
13 matches
Mail list logo