Hi there,
I'm another new cakePHP user trying to wrap my brain around this
system. My apologies if this is already addressed elsewhere, but I
just cannot figure this out:
To teach myself Cake, I'm building a listing/review site. As of right
now, I have a
- User, which hasMany 'Review', 'Listing', and 'ProfileImage'
- Review, which belongsTo 'User' and 'Listing'
- Listing, which hasMany 'Review' , belongsTo 'User', and
hasAndBelongsToMany 'Tag' and 'ListingImage'
Right now, I am trying to craft the view for the 'view' action for my
ListingsController. That is, I'm trying to build the page that
displays a single listing. Right now, it looks like this:
function view($id = null)
{
$this->helpers[] = 'Format';
$this->Listing->id = $id;
$this->layout = 'two-column';
$this->set('listing', $this->Listing->read());
$this->set('reviews', $this->Listing->Review-
>findAllByListingId($id));
}
which already feels a bit less elegant than I think it can be. But
this allows me to display the information stored in the listings table
(name, address, etc.), one of the 'ListingImages' stored for the
listing, all of the reviews for that listing, and the names of the
users that wrote those reviews.
This brings me to my question: what is the best way to display the
user's picture next to their name? Do I attempt to set the recursion
depth higher for one (or some combination) of the model(s)? That gets
to pulling a lot of extra data. Do I try to create extra queries?
How should they be structured so as to keep in line with cake's MVC
paradigm?
Let me know if I am leaving out any critical information, or if you
have any clarifying questions. The problem is probably (hopefully)
black and white to a more experienced cake developer, so please
forgive my naiveness. I appreciate any ideas you have. Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---