Tuesday, November 23, 2010

Re: Model - Retrieve data

Or even better this!!!

Example:

Array
(
[Projectcategory] = Array
(
[id] => 2
[title] => Residential
[alias] => residential
[imagepath] =>
[weight] => 1
[published] => 1
[RANDOM IMAGE FROM PROJECTS BELONG TO THIS CATEGORY FOUND
IN PROJECTIMAGES TABLE WHICH BELONGS TO PROJECTS]
)
}

Thanks!

On Nov 23, 5:49 pm, Sarpidon <epap...@gmail.com> wrote:
> Hi. I am not sure how to do the following  - what is the best
> practice.
>
> I have a Projectcategories table that has many Projects.
> A Project has many Projectimages. What I want to do is to get the
> Projectcategory and a random image for each Project from
> Projectimages.
>
> For example:
>
> Array
> (
>     [Projectcategory] => Array
>         (
>             [id] => 2
>             [title] => Residential
>             [alias] => residential
>             [imagepath] =>
>             [weight] => 1
>             [published] => 1
>         )
>
>     [Project] => Array
>         (
>             [0] => Array
>                 (
>                     [id] => 1
>                     [category_id] => 2
>                     [title] => Project title
>                     [weight] => 1
>                     [published] => 1
>                     [Projectimage] => Random image from Projectimages
> table
>                )
>           )
> )
>
> I hope I am making my self clear :)
>
> Any ideas?

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: