There are two ways:
1- $model = ClassRegistry::init('TheClassModelYouWant');
2- if the model you need is used by the controller you are monitoring in the
moment you need to save the data:
    $model =& $controller->model[0] //By convention use the first model -
and yes, even in cake's core this convention is used in some places -


--
anl


On Wed, Feb 17, 2010 at 4:56 PM, amiable_indian <[email protected]>wrote:

> According to,
> http://book.cakephp.org/view/65/MVC-Class-Access-Within-Components
>
> "To access/use a model in a component is not generally recommended; If
> you end up needing one, you'll need to instantiate your model class
> and use it manually."
>
> So, what is the recommended way if I have some data in component that
> i need to store?
>
> Only other way I could think of was to send this data back to
> controller which called the component and let controller store the
> data. But, then I will end up duplicating that code for almost every
> controller that uses this component.
>
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to