Thanks Calvin. I get it.

On May 20, 8:44 pm, calvin <cal...@rottenrecords.com> wrote:
> I mean referencing the model object itself, i.e. $this->User->find()
> instead of $model->find() or User->find().
>
> On May 20, 10:18 am, bradmaxs <b...@pezzano.com> wrote:
>
>
>
> > Thanks Calvin.
>
> > When you say access models from controllers, do you mean with find().
>
> > Trying some different methods as we speak.
>
> > On May 20, 4:07 am, calvin <cal...@rottenrecords.com> wrote:
>
> > > Assuming that's exactly what your code looks like, the
> > > T_OBJECT_OPERATOR error is probably because you're putting a
> > > T_OBJECT_OPERATOR ("->") after a constant ("User"). If you want the
> > > model, then you need to write $this->User. Likewise, unless you
> > > declared a variable previously named $model, calling $model-
>
> > > >anything() is going to result in an error.
>
> > > Jeremy's recommendations are good, but you should still read up on how
> > > to access models from controllers in the Cookbook. That will help you
> > > avoid encountering similar errors in the future.
>
> > > On May 19, 7:17 pm, bradmaxs <b...@pezzano.com> wrote:
>
> > > > I want to send an email with the email component.  No problem there.
>
> > > > However, I don't want it to be a hidden field in the form so I thought
> > > > I could do something in the controller.
>
> > > > So I did this line:
>
> > > > $email = $this->User->find('first', array('conditions' =>
> > > > array('User.id' => $this->data['Friend']['friend_id']), 'fields' =>
> > > > 'User.email_address'));
>
> > > > Which to my surprise (still learning all of these functions) it did
> > > > get the email address but the find function turns the info into an
> > > > array and then the email component has an array to deal with rather
> > > > than the specific string (email_address).
>
> > > > I thought I could use the field() method but I am confused as to how
> > > > to get it to work and there isn't much documentation.
>
> > > > I tried:
>
> > > > $email = User->field('email_address', array('id' => $this-
>
> > > > >data['Friend']['friend_id']));
>
> > > > and got:
>
> > > > Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /var/www/
> > > > vhosts/theactorstoolkit.com/httpdocs/app/controllers/
> > > > users_controller.php  on line 69
>
> > > > which shows up on the screen before I even get to the page.
>
> > > > I tried:
>
> > > > $email = $model->field('email_address', array('id' => $this-
>
> > > > >data['Friend']['friend_id']));
>
> > > > and once I submit the form it gives me:
>
> > > > Notice (8): Undefined variable: model [APP/controllers/
> > > > users_controller.php, line 69]
>
> > > > Anyone know how this should be done.
>
> > > > Thank you!
>
> > > > Brad
>
> > > > Check out the new CakePHP Questions 
> > > > sitehttp://cakeqs.organdhelpotherswith their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > group athttp://groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to