Message from discussion
Yet another "Call to a member function find on a non-object" error
Received: by 10.43.120.4 with SMTP id fw4mr15687407icc.28.1352870074827;
Tue, 13 Nov 2012 21:14:34 -0800 (PST)
X-BeenThere: cake-php@googlegroups.com
Received: by 10.42.129.139 with SMTP id q11ls161478ics.5.gmail; Tue, 13 Nov
2012 21:14:09 -0800 (PST)
Received: by 10.42.180.2 with SMTP id bs2mr15923731icb.3.1352870049495;
Tue, 13 Nov 2012 21:14:09 -0800 (PST)
Received: by 10.42.180.2 with SMTP id bs2mr15923728icb.3.1352870049475;
Tue, 13 Nov 2012 21:14:09 -0800 (PST)
Return-Path: <bill.sto...@boosterwebsolutions.com>
Received: from sam.nabble.com (sam.nabble.com. [216.139.236.26])
by gmr-mx.google.com with ESMTPS id o7si54286igl.0.2012.11.13.21.14.09
(version=TLSv1/SSLv3 cipher=OTHER);
Tue, 13 Nov 2012 21:14:09 -0800 (PST)
Received-SPF: softfail (google.com: domain of transitioning bill.sto...@boosterwebsolutions.com does not designate 216.139.236.26 as permitted sender) client-ip=216.139.236.26;
Authentication-Results: gmr-mx.google.com; spf=softfail (google.com: domain of transitioning bill.sto...@boosterwebsolutions.com does not designate 216.139.236.26 as permitted sender) smtp.mail=bill.sto...@boosterwebsolutions.com
Received: from [192.168.236.26] (helo=sam.nabble.com)
by sam.nabble.com with esmtp (Exim 4.72)
(envelope-from <bill.sto...@boosterwebsolutions.com>)
id 1TYVIe-0005Hn-Me
for cake-php@googlegroups.com; Tue, 13 Nov 2012 21:14:08 -0800
Date: Tue, 13 Nov 2012 21:14:08 -0800 (PST)
From: bs28723 <bill.sto...@boosterwebsolutions.com>
To: cake-php@googlegroups.com
Message-ID: <A810AB4C-0559-48C3-BC86-105F9BE778CB@boosterwebsolutions.com>
In-Reply-To: <4ee2c9ef-2529-4f3a-8adb-aa25805e0534@googlegroups.com>
References: <4ee2c9ef-2529-4f3a-8adb-aa25805e0534@googlegroups.com>
Subject: Re: Yet another "Call to a member function find on a non-object"
error
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_134135_14452564.1352870048696"
------=_Part_134135_14452564.1352870048696
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I don't think you provided enough info for anyone to help you.
Please provide the function and point out the line that is getting the error.
Thanks,
Bill Stoltz
On Nov 13, 2012, at 10:31 PM, "Andrew Johnston [via CakePHP]" <ml-node+s1045679n571225...@n5.nabble.com> wrote:
> I know this post gets written every couple of months, and I swear that I've read through all of the back posts, yet can't find a solution that works.
>
> Whenever I try to call related data from one of my models, I get the above error. Below is the relationship code for each model.
>
> class Slide extends AppModel {
> public $name = 'Slide';
> public $belongsTo = array(
> 'Module' => array(
> 'className' => 'Module',
> 'foreignKey' => 'module_id',
> ));
>
> class Module extends AppModel {
> public $name = 'Module';
> public $hasMany = array(
> 'Slide' => array(
> 'className' => 'Slide',
> 'foreignKey' => 'module_id',
> 'order' => 'Slide.position ASC',
> 'dependent' => true
> )
> );
> public $belongsTo = array(
> 'Creator' => array(
> 'className' => 'User'));
> public $hasAndBelongsToMany = array(
> 'Learner' => array(
> 'className' => 'User',
> 'joinTable' => 'modules_users',
> 'foreignKey' => 'module_id',
> 'associationForeignKey' => 'users_id',
> 'unique' => 'keepExisting',
> ));
>
> class User extends AppModel {
> public $name = 'User';
> public $uses = 'users';
> public $hasMany = array(
> 'OModule' => array(
> 'className' => 'Module',
> 'foreignKey' => 'users_id',
> 'order' => 'Module.created DESC'
> ));
> public $hasAndBelongsToMany = array(
> 'Module' => array( //We gotta remember this later...
> 'className' => 'Module',
> 'joinTable' => 'modules_users',
> 'foreignKey' => 'user_id',
> 'associationForeignKey' => 'module_id',
> 'unique' => 'keepExisting',
> ));
>
> I've tried to adhere to all of the requirements outlined in the CookBook, but I know I must be doing something wrong. Any help is appreciated. Thanks in advance.
>
> Andrew
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>
>
> If you reply to this email, your message will be added to the discussion below:
> http://cakephp.1045679.n5.nabble.com/Yet-another-Call-to-a-member-function-find-on-a-non-object-error-tp5712251.html
> To start a new topic under CakePHP, email ml-node+s1045679n125572...@n5.nabble.com
> To unsubscribe from CakePHP, click here.
> NAML
--
View this message in context: http://cakephp.1045679.n5.nabble.com/Yet-another-Call-to-a-member-function-find-on-a-non-object-error-tp5712251p5712254.html
Sent from the CakePHP mailing list archive at Nabble.com.
------=_Part_134135_14452564.1352870048696
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8"><d=
iv>I don't think you provided enough info for anyone to help you. </di=
v><div><br></div><div>Please provide the function and point out the line th=
at is getting the error. <br><br>Thanks,<div>Bill Stoltz</div></div><d=
iv><br>On Nov 13, 2012, at 10:31 PM, "Andrew Johnston [via CakePHP]" <<a=
href=3D"/user/SendEmail.jtp?type=3Dnode&node=3D5712254&i=3D0" target=3D"_t=
op" rel=3D"nofollow" link=3D"external">[hidden email]</a>> wrote:<br><br=
></div><blockquote style=3D'border-left:2px solid #CCCCCC;padding:0 1em' ty=
pe=3D"cite"><div>
=09I know this post gets written every couple of months, and I swear that I=
've read through all of the back posts, yet can't find a solution that work=
s.<div><br></div><div>Whenever I try to call related data from one of my mo=
dels, I get the above error. Below is the relationship code for each model.=
</div><div><br></div><div><div>class Slide extends AppModel {</div><div><sp=
an class=3D"Apple-tab-span" style=3D"white-space:pre">=09</span>public $nam=
e =3D 'Slide';</div><div><span class=3D"Apple-tab-span" style=3D"white-spac=
e:pre">=09</span>public $belongsTo =3D array(</div><div><span class=
=3D"Apple-tab-span" style=3D"white-space:pre">=09</span>'Module' =3D> ar=
ray(</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">=09=
=09</span>'className' =3D> 'Module',</div><div><span class=3D"Apple-tab-=
span" style=3D"white-space:pre">=09=09</span>'foreignKey' =3D> 'module_i=
d',</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">=09=
=09</span>));</div></div><div><br></div><div><div>class Module extends AppM=
odel {</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">=
=09</span>public $name =3D 'Module';</div><div><span class=3D"Apple-tab-spa=
n" style=3D"white-space:pre">=09</span>public $hasMany =3D array(</div><div=
><span class=3D"Apple-tab-span" style=3D"white-space:pre">=09=09</span>'Sli=
de' =3D> array(</div><div><span class=3D"Apple-tab-span" style=3D"white-=
space:pre">=09=09=09</span>'className' =3D> 'Slide',</div><div><sp=
an class=3D"Apple-tab-span" style=3D"white-space:pre">=09=09=09</span>'fore=
ignKey' =3D> 'module_id',</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre">=09=09=09</span>'order' =3D> 'Slide.position ASC',<=
/div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">=09=09=
=09</span>'dependent' =3D> true</div><div><span class=3D"Apple-tab-span"=
style=3D"white-space:pre">=09=09</span>)</div><div><span class=3D"Apple-ta=
b-span" style=3D"white-space:pre">=09</span>);</div><div><span class=3D"App=
le-tab-span" style=3D"white-space:pre">=09</span>public $belongsTo =3D arra=
y(</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">=09=
=09</span>'Creator' =3D> array(</div><div><span class=3D"Apple-tab-span"=
style=3D"white-space:pre">=09=09=09</span>'className' =3D> 'User'));<sp=
an class=3D"Apple-tab-span" style=3D"white-space:pre">=09</span></div><div>=
<span class=3D"Apple-tab-span" style=3D"white-space:pre">=09</span>public $=
hasAndBelongsToMany =3D array(</div><div><span class=3D"Apple-tab-span" sty=
le=3D"white-space:pre">=09=09</span>'Learner' =3D> array(</div><div><spa=
n class=3D"Apple-tab-span" style=3D"white-space:pre">=09=09</span> '=
className' =3D> 'User',<=
/div><div> 'joinTable'  =
; =3D> 'modules_users',</div><div>&nbs=
p; 'foreignKey' &nbs=
p; =3D> 'module_id',</div><div> =
'associationForeignKey' =3D> 'users_id',</div><div>&=
nbsp; 'unique'  =
; =3D> 'keepExisting',</div><div><span class=
=3D"Apple-tab-span" style=3D"white-space:pre">=09=09</span>));<span class=
=3D"Apple-tab-span" style=3D"white-space:pre">=09=09</span></div></div><div=
><br></div><div><div>class User extends AppModel {</div><div><span class=3D=
"Apple-tab-span" style=3D"white-space:pre">=09</span>public $name =3D 'User=
';</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">=09</=
span>public $uses =3D 'users';</div><div><span class=3D"Apple-tab-span" sty=
le=3D"white-space:pre">=09</span>public $hasMany =3D array(</div><div><span=
class=3D"Apple-tab-span" style=3D"white-space:pre">=09=09</span>'OModule' =
=3D> array(</div><div><span class=3D"Apple-tab-span" style=3D"white-spac=
e:pre">=09=09=09</span>'className' =3D> 'Module',</div><div><span class=
=3D"Apple-tab-span" style=3D"white-space:pre">=09=09=09</span>'foreignKey' =
=3D> 'users_id',</div><div><span class=3D"Apple-tab-span" style=3D"white=
-space:pre">=09=09=09</span>'order' =3D> 'Module.created DESC'</div><div=
><span class=3D"Apple-tab-span" style=3D"white-space:pre">=09=09=09</span>)=
);</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">=09</=
span>public $hasAndBelongsToMany =3D array(</div><div><span class=3D"Apple-=
tab-span" style=3D"white-space:pre">=09=09</span>'Module' =3D> array( //=
We gotta remember this later...</div><div><span class=3D"Apple-tab-span" st=
yle=3D"white-space:pre">=09=09</span> 'className' &nbs=
p; =3D> 'Module',</div><div> &nb=
sp; 'joinTable' &nbs=
p; =3D> 'modules_users',</div><div> &nb=
sp; 'foreignKey' =3D> 'u=
ser_id',</div><div> 'associationFor=
eignKey' =3D> 'module_id',</div><div> &=
nbsp; 'unique'  =
; =3D> 'keepExisting',</div><div><span class=3D"Apple-tab-span" style=3D=
"white-space:pre">=09=09</span>));</div></div><div><br></div><div>I've trie=
d to adhere to all of the requirements outlined in the CookBook, but I know=
I must be doing something wrong. Any help is appreciated. Thanks in advanc=
e.</div><div><br></div><div>Andrew</div>
<p></p>
-- <br>
Like Us on FaceBook <a href=3D"https://www.facebook.com/CakePHP" target=3D"=
_top" rel=3D"nofollow" link=3D"external">https://www.facebook.com/CakePHP</=
a><br>
Find us on Twitter <a href=3D"http://twitter.com/CakePHP" target=3D"_top" r=
el=3D"nofollow" link=3D"external">http://twitter.com/CakePHP</a><br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
CakePHP" group.<br>
To post to this group, send email to <a href=3D"/user/SendEmail.jtp?type=3D=
node&node=3D5712251&i=3D0" target=3D"_top" rel=3D"nofollow" link=3D=
"external">[hidden email]</a>.<br>
To unsubscribe from this group, send email to <a href=3D"/user/SendEmail.jt=
p?type=3Dnode&node=3D5712251&i=3D1" target=3D"_top" rel=3D"nofollow=
" link=3D"external">[hidden email]</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/group/cake-php?hl=
=3Den" target=3D"_top" rel=3D"nofollow" link=3D"external">http://groups.goo=
gle.com/group/cake-php?hl=3Den</a>.<br>
<br>
<br>
=09
=09
=09
=09<br>
=09<br>
=09<hr noshade=3D"noshade" size=3D"1" color=3D"#cccccc">
=09<div style=3D"color:#444; font: 12px tahoma,geneva,helvetica,arial,sans-=
serif;">
=09=09<div style=3D"font-weight:bold">If you reply to this email, your mess=
age will be added to the discussion below:</div>
=09=09<a href=3D"http://cakephp.1045679.n5.nabble.com/Yet-another-Call-to-a=
-member-function-find-on-a-non-object-error-tp5712251.html" target=3D"_top"=
rel=3D"nofollow" link=3D"external">http://cakephp.1045679.n5.nabble.com/Ye=
t-another-Call-to-a-member-function-find-on-a-non-object-error-tp5712251.ht=
ml</a>
=09</div>
=09<div style=3D"color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-=
serif;margin-top:.4em;line-height:1.5em">
=09=09To start a new topic under CakePHP, email <a href=3D"/user/SendEmail.=
jtp?type=3Dnode&node=3D5712254&i=3D1" target=3D"_top" rel=3D"nofollow" link=
=3D"external">[hidden email]</a> <br>
=09=09To unsubscribe from CakePHP, <a href=3D"" target=3D"_top" rel=3D"nofo=
llow" link=3D"external">click here</a>.<br>
=09=09<a href=3D"http://cakephp.1045679.n5.nabble.com/template/NamlServlet.=
jtp?macro=3Dmacro_viewer&id=3Dinstant_html%21nabble%3Aemail.naml&ba=
se=3Dnabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleN=
amespace-nabble.view.web.template.NodeNamespace&breadcrumbs=3Dnotify_su=
bscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_i=
nstant_email%21nabble%3Aemail.naml" rel=3D"nofollow" style=3D"font:9px seri=
f" target=3D"_top" link=3D"external">NAML</a>
=09</div></div></blockquote>
=09
=09
=09
<br/><hr align=3D"left" width=3D"300" />
View this message in context: <a href=3D"http://cakephp.1045679.n5.nabble.c=
om/Yet-another-Call-to-a-member-function-find-on-a-non-object-error-tp57122=
51p5712254.html">Re: Yet another "Call to a member function find on a =
non-object" error</a><br/>
Sent from the <a href=3D"http://cakephp.1045679.n5.nabble.com/">CakePHP mai=
ling list archive</a> at Nabble.com.<br/>
------=_Part_134135_14452564.1352870048696--