Tuesday, December 29, 2009

Re: 1 controller 2 models =)

in your controller, you can set as many models as you want to use.

like:

var $uses = arraya('Image','Article');

to save data in each model, you can just access it like:
$this->Image->save($your-data-var);
$this->Article->save($your-other-data-var);

if there is a way to make your article model save the image on image model, i dont know... but that way work..

--
Renato de Freitas Freire
renato@morfer.org


On Tue, Dec 29, 2009 at 2:41 AM, Wils <anjo.virtual@gmail.com> wrote:
Hi Guys,

How's going?

so, I trying to figure out the following scenario:

2 models:
 - articles
 - images

on my images table i have a column id_article.

1 view:
 - article + the field to upload 1 image.

Problem:
HOw to store the image using article_model and pass the data to
images_model?


tks
Wils

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: