As usual, I am not looking for easy ways, and as usual I come across tasks not covered in book.cakephp.org ;-)
Always, the most troublesome part of the project for me was paginate and everything connected with it (sampling, sorting).
And now, once again, I stepped on a rake, and the answer to my question is no.
')
So, what was the problem:
Model A - hasMany Model B
Model B - belongsTo Model A
Model B - actAs ('Image')
Image -
Evgeny Tomenko's wonderful behavior, which serves as a bunch of entries in the model with the saved picture.
In the case of a request for Model B -> ... of any form, the behavior worked like a clock, and I received the data I needed, in this case, the pictures.
However, when the task became to build a query of the form
Model B -> Model -> A (with the conditions where the sample goes through the fields of Model A)
it turned out that search and training work fine, but in the results of the associated Model B, there is no trace of the work of behavior ... I just received the model fields, without the “distortions” I needed.
No dancing with the Container, order of request, etc. - led to nothing. There is also no answer in the Google Group.
And today I found another rake, but with behavior Translate. If you use the
instructions , and how to consult there, everything works fine, except for my favorite training ...
Namely - it is impossible to sort by the fields located in the i18n table. Will not work. Only for those fields that are present in an explicit form. Like this.
Of course, I don’t want to say that the sorting table built through i18n will work quickly, or in principle it will work in a sane way. Maybe not. But in this case, if you need to sort the results except for id, created somehow, then you have no chance to use this behavior. It will not work. :(
And if the first rake can be bypassed by the second request (first getting the id Model B list, and then requesting all the records directly from Model B. (this is where the behavior will work.) Then, in the second one, the only way to sort is to do without boxed behavior.
2All: If someone has solved these questions - share the solution in the comments. This is about CakePHP 1.2.3.8166