Wednesday, February 23, 2011

Re: Containable, paginate, Trying to get property of non-object

I should have mentioned before that everything seems to be working correctly -- it correctly fetches and displays only the data I've specified -- the only problem I see is that CakePHP generates this notice.


On Feb 24, 2011, at 00:25, Jeremy Burns | Class Outfit wrote:

> What happens if you add a $hasMany Place statement to the Thing model?

But a Thing doesn't hasMany Place; it has one Place, and one CurrentPlace.

However, a Place does hasMany Thing.

I see I was mistaken earlier when I said:

> On 24 Feb 2011, at 05:44, Ryan Schmidt wrote:
>
>> In models/place.php I don't have any relationships defined about Things (do I need to?)

I do in fact have a hasMany relationship defined for Place:

class Place extends AppModel {
var $hasMany = array(
'Thing' => array(
'className' => 'Thing',
'foreignKey' => 'place_id',
'dependent' => false,
),
...
);
...
}

But I don't have one defined for CurrentPlace. I tried defining it like this:

'Thing2' => array(
'className' => 'Thing',
'foreignKey' => 'current_place_id',
'dependent' => false,
),

but that results in "Fatal error: Maximum function nesting level of '100' reached, aborting! in /.../cake/libs/debugger.php on line 248". I had not been clear on whether there should be anything defined in the Place model for CurrentPlace, and when I ran into this error before, I tried without it, and everything else I did until now seemed to work that way.

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: