Wednesday, June 30, 2010

Re: Accessing one model from another (unrelated) model

Hi,
this is a bit more "cakeish":

App::import('Product', 'Product');
$this->Product = new Product();

Now you can use the model as you ordinary would with e.g.
$this->Product->find(...)


Erik Starck
@erikstarck
http://www.softwaresweden.com

On Tue, Jun 29, 2010 at 5:12 PM, WhyNotSmile <sharongilmore78@gmail.com> wrote:
> Thanks for the replies.  Erik's solution worked (using
> ClassRegistry).  For some reason, loadModel threw an error.
>
> I may rewrite it to use a behaviour, but at least it's working for
> now!
>
> Thanks again,
> Sharon
>
> 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
>

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: