If you have author's id then to find all books for that author
ordered/sorted by categories, you can also do,
Category->findAll("Book.author_id = $author_id", null, 'Category.name ASC');
On 10/19/07, BoSc <[EMAIL PROTECTED]> wrote:
>
>
> You're right, in Cake lingo this is called HABTM, in normal
You're right, in Cake lingo this is called HABTM, in normal database
ERD's they both have a Has Many relationship with eachother
ofcourse I have modeled this with HABTM, but thanks for your
correction!
Your solution to the order problem is 'spot on', actually what I was
looking for! I didn't
On 10/18/07, BoSc <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
>
> I've got 3 tables with a 1:n relationship:
>
> - author (has many books)
> ^
> |
> |
> V
> - books (belongs to categories) (has many authors)
- I think you made a mistake here, actual relationships may be author HABTM
books and books HA
It's real code - try it! So is Category->findAllById(). Cakey
automagic goodness!
They're nice shortcuts, but they do make it difficult to set other
options, like order, recursive, and whatnot.
On Oct 18, 11:06 am, BoSc <[EMAIL PROTECTED]> wrote:
> Btw is the findAllByAuthorId intented to be
Btw is the findAllByAuthorId intented to be pseudo-code, or is
this really possible in CakePHP?
On Oct 18, 11:55 am, grigri <[EMAIL PROTECTED]> wrote:
> I'm not 100% sure of the "official" way of doing this, but I'd do it
> by putting a specialized search function in the model. Which model is
Hi Grigri,
Thanks for all your trouble, it's more clear to me now!
I'll go and try to implement this in my app.
(it's clear to me now that this is not something that is done in 1
Cakephp function/method)
On Oct 18, 11:55 am, grigri <[EMAIL PROTECTED]> wrote:
> I'm not 100% sure of the "officia
I'm not 100% sure of the "official" way of doing this, but I'd do it
by putting a specialized search function in the model. Which model is
up to you - a bit of a grey area. I've written a quick (untested!)
example, in which I've put it in the Author class. Depending on other
stuff, it might make m
Hi,
I've got 3 tables with a 1:n relationship:
- author (has many books)
^
|
|
V
- books (belongs to categories) (has many authors)
|
|
V
- categories (has many books)
What I would like to do on one page, is show a categorized view of all
books by a specific author. The problem lies in th