Monday, February 3, 2014

Re: Getting information from a model inside of a model file

Thank you for your help! :)

On Monday, February 3, 2014 10:25:38 AM UTC-7, AD7six wrote:
The $id property can be accessed without any problems. 

The primary key value (whether it's named id or not) is accessed via $this->id in CakePHP

> But the only way that I can get to any of the other information is to go through the data array: $this->data['InvoiceItem']['quantity'].

You can add __get to your app model to make other properties accessible in the way you ask but ^ is the normal way to access a models data.

AD

--
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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: