Thursday, February 4, 2010

Re: Retrieve data in a model from another unassociated model

Never mind, found it :-)

For anyone else looking for the answer here it is...

In model:

function foo() {

$Setting = ClassRegistry::init('Setting');

$first_class_cost = $Setting->findValue("1st Class");

}


On Feb 4, 4:50 pm, "Richard@Home" <richardath...@gmail.com> wrote:
> Hi all.
>
> I have a stand-alone (not associated with any other model) Setting
> model that contains key/value pairs containing user editable values
> used throughout my app (VAT rate, postal costs etc.)
>
> I'd like to get at this Setting data inside another model method
> (Order::calculateTotal() for example)
>
> I know I can get this data in the Controller using var $use... or
> $this->loadModel(), but how do I get at it in the model?

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

No comments: