Re: Recursive find but not in all models

2010-06-23 Thread Jeremy Burns | Class Outfit
http://book.cakephp.org/view/1323/Containable

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 23 Jun 2010, at 05:12, cdvrooman wrote:

> Fernando,
> 
>  you should use $this->User->unbindModel(array(
>'belongsTo' => array('Company'),
>'hasMany' => array('Table1', 'Table2', 'Table3'),
>'hasAndBelongsToMany => array('Table4', 'Table5')
> ));
> 
>  before performing your query. Try unbinding all of the unwanted
> models associated with the User directory first. To make the unbinding
> permanent for the duration of the execution within the controller you
> can end the ->unbindModel call with:
> $this->User->unbindModel(array(
> ..
> ), false);
> 
>  Good luck.
> 
> On Jun 22, 9:52 pm, "Fernando Z. Bob"  wrote:
>> Hi.
>> I have a lot of relations between Users and another models.
>> 
>> Like:
>> 
>> User hasMany Download
>> User belongsTo Company
>> Company hasMany Product
>> Download hasMany Type
>> 
>> So I wanna use the find method, like $this->User->find('first',
>> array('conditions'=>bla bla bla));
>> 
>> But, it returns me ALL the data contained in Company, Product, etc...
>> I don't want this. I just want the recursive find enters the Download table.
>> 
>> Do someone have the idea of how can I do that?
>> 
>> Thank you.
> 
> 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+unsubscr...@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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Recursive find but not in all models

2010-06-23 Thread cdvrooman
Fernando,

  you should use $this->User->unbindModel(array(
'belongsTo' => array('Company'),
'hasMany' => array('Table1', 'Table2', 'Table3'),
'hasAndBelongsToMany => array('Table4', 'Table5')
));

  before performing your query. Try unbinding all of the unwanted
models associated with the User directory first. To make the unbinding
permanent for the duration of the execution within the controller you
can end the ->unbindModel call with:
$this->User->unbindModel(array(
..
), false);

  Good luck.

On Jun 22, 9:52 pm, "Fernando Z. Bob"  wrote:
> Hi.
> I have a lot of relations between Users and another models.
>
> Like:
>
> User hasMany Download
> User belongsTo Company
> Company hasMany Product
> Download hasMany Type
>
> So I wanna use the find method, like $this->User->find('first',
> array('conditions'=>bla bla bla));
>
> But, it returns me ALL the data contained in Company, Product, etc...
> I don't want this. I just want the recursive find enters the Download table.
>
> Do someone have the idea of how can I do that?
>
> Thank you.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Recursive find but not in all models

2010-06-22 Thread ecommy.com
use containable behaviour: http://book.cakephp.org/view/474/Containable

On Jun 22, 8:52 pm, "Fernando Z. Bob"  wrote:
> Hi.
> I have a lot of relations between Users and another models.
>
> Like:
>
> User hasMany Download
> User belongsTo Company
> Company hasMany Product
> Download hasMany Type
>
> So I wanna use the find method, like $this->User->find('first',
> array('conditions'=>bla bla bla));
>
> But, it returns me ALL the data contained in Company, Product, etc...
> I don't want this. I just want the recursive find enters the Download table.
>
> Do someone have the idea of how can I do that?
>
> Thank you.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Recursive find but not in all models

2010-06-22 Thread Fernando Z. Bob
Hi.
I have a lot of relations between Users and another models.

Like:

User hasMany Download
User belongsTo Company
Company hasMany Product
Download hasMany Type



So I wanna use the find method, like $this->User->find('first',
array('conditions'=>bla bla bla));

But, it returns me ALL the data contained in Company, Product, etc...
I don't want this. I just want the recursive find enters the Download table.

Do someone have the idea of how can I do that?

Thank you.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help with recursive find

2010-04-13 Thread cricket
On Apr 13, 4:48 pm, Rafael Cesar  wrote:
> Hey.. What's up guys..?
> I'm just beggining with Cake, and I'm still getting used to the MVC
> architecture...
> So.. right now I'm facing a "problem" and I really need your help..
>
> There's the thing.. I have the table
> Stores (id,name,city_id,...)
> Cities (id,state_id,name)
> States (id,name)

OK. And make sure your associations are correct.

model State:
var $hasMany = array('City');

model City:
var $belongsTo = array('State');
var $hasMany = array('Store');

model Store:
var $belongsTo = array('City');

> So.. What I want to do: Basically I want to get the Name of the store,
> the name of the city and the name of the state where the store is
> located...
>
> The problem is that using recursive level = 2 , I get much, much more
> data than I expect, overloading my server, because it lists the table
> People, with people from each city it lists..
> Using other levels, I just can get to the City name, but not the State
> name..

Yeah, recursive 2 can be a killer. If you really want to have some
fun, set debug to 3!

Anyway, try using ContainableBehavior. I've taken to including it in
my AppModel's $actsAs array because I use it so much.

model Store:

function fetchById($id = null)
{
return $this->find(
'first',
array(
'fields' => array('*'),
'conditions' => array(
'Store.id' => $id
),
'contain' => array(
'City' => array(
'State'
)
)
)
);
}

Debug the returned data to get a feel for how it's laid out.

> I've tryed using "expect", but I get some error messages and nothing
> seems to work...

You should never post to a list saying you have "some error messages"
without also including at least some of them. ;-)

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.


Help with recursive find

2010-04-13 Thread Rafael Cesar
Hey.. What's up guys..?
I'm just beggining with Cake, and I'm still getting used to the MVC
architecture...
So.. right now I'm facing a "problem" and I really need your help..

There's the thing.. I have the table
Stores (id,name,city_id,...)
Cities (id,state_id,name)
States (id,name)

So.. What I want to do: Basically I want to get the Name of the store,
the name of the city and the name of the state where the store is
located...

The problem is that using recursive level = 2 , I get much, much more
data than I expect, overloading my server, because it lists the table
People, with people from each city it lists..
Using other levels, I just can get to the City name, but not the State
name..

I've tryed using "expect", but I get some error messages and nothing
seems to work...

Please, can someone help me..?

Thanks in advance

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.


Re: recursive find: related models order

2009-09-24 Thread lorenx

ok, thank you very much!

On Sep 24, 1:58 pm, Bert Van den Brande  wrote:
> If I understand you question correctly I think you're right :)
>
>
>
> On Thu, Sep 24, 2009 at 1:27 PM, lorenx  wrote:
>
> > perfect, thanks!
>
> > just one little question:
> > if i have a deep and complex recursion and i just want a condition on
> > a single model in the middle of the tree... it seems that i also have
> > to specify all the other models not to have them filtered out, am i
> > right?
>
> > On Sep 24, 11:09 am, Bert Van den Brande  wrote:
> > > Search the Cake book for 'Containable' behavior , I think you will find
> > your
> > > answer there
>
> > > On Thu, Sep 24, 2009 at 10:53 AM, lorenx  wrote:
>
> > > > hi all.
>
> > > > i'm trying to order a deeply related model but the following code
> > > > gives me an error.
>
> > > > $params = array(
> > > >        'order' => 'RelatedModel.relatedmodel_field DESC',
> > > >        'recursive' => 3
> > > > );
> > > > $models_array = $this->Model->find('all', $params);
>
> > > > i saw that cakephp do several queries to build $models_array and the
> > > > order parameter is appended to the first query, the one with no
> > > > RelatedModel reference.
> > > > i also tried to set $order in the model but it didn't solve (and i
> > > > don't want a static order anyway...)
>
> > > > how does cakephp handle this issue?
>
> > > > thanks to all, very much.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: recursive find: related models order

2009-09-24 Thread Bert Van den Brande
If I understand you question correctly I think you're right :)

On Thu, Sep 24, 2009 at 1:27 PM, lorenx  wrote:

>
> perfect, thanks!
>
> just one little question:
> if i have a deep and complex recursion and i just want a condition on
> a single model in the middle of the tree... it seems that i also have
> to specify all the other models not to have them filtered out, am i
> right?
>
>
> On Sep 24, 11:09 am, Bert Van den Brande  wrote:
> > Search the Cake book for 'Containable' behavior , I think you will find
> your
> > answer there
> >
> >
> >
> > On Thu, Sep 24, 2009 at 10:53 AM, lorenx  wrote:
> >
> > > hi all.
> >
> > > i'm trying to order a deeply related model but the following code
> > > gives me an error.
> >
> > > $params = array(
> > >'order' => 'RelatedModel.relatedmodel_field DESC',
> > >'recursive' => 3
> > > );
> > > $models_array = $this->Model->find('all', $params);
> >
> > > i saw that cakephp do several queries to build $models_array and the
> > > order parameter is appended to the first query, the one with no
> > > RelatedModel reference.
> > > i also tried to set $order in the model but it didn't solve (and i
> > > don't want a static order anyway...)
> >
> > > how does cakephp handle this issue?
> >
> > > thanks to all, very much.
> >
>

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: recursive find: related models order

2009-09-24 Thread lorenx

perfect, thanks!

just one little question:
if i have a deep and complex recursion and i just want a condition on
a single model in the middle of the tree... it seems that i also have
to specify all the other models not to have them filtered out, am i
right?


On Sep 24, 11:09 am, Bert Van den Brande  wrote:
> Search the Cake book for 'Containable' behavior , I think you will find your
> answer there
>
>
>
> On Thu, Sep 24, 2009 at 10:53 AM, lorenx  wrote:
>
> > hi all.
>
> > i'm trying to order a deeply related model but the following code
> > gives me an error.
>
> > $params = array(
> >        'order' => 'RelatedModel.relatedmodel_field DESC',
> >        'recursive' => 3
> > );
> > $models_array = $this->Model->find('all', $params);
>
> > i saw that cakephp do several queries to build $models_array and the
> > order parameter is appended to the first query, the one with no
> > RelatedModel reference.
> > i also tried to set $order in the model but it didn't solve (and i
> > don't want a static order anyway...)
>
> > how does cakephp handle this issue?
>
> > thanks to all, very much.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: recursive find: related models order

2009-09-24 Thread Bert Van den Brande
Search the Cake book for 'Containable' behavior , I think you will find your
answer there

On Thu, Sep 24, 2009 at 10:53 AM, lorenx  wrote:

>
> hi all.
>
> i'm trying to order a deeply related model but the following code
> gives me an error.
>
> $params = array(
>'order' => 'RelatedModel.relatedmodel_field DESC',
>'recursive' => 3
> );
> $models_array = $this->Model->find('all', $params);
>
> i saw that cakephp do several queries to build $models_array and the
> order parameter is appended to the first query, the one with no
> RelatedModel reference.
> i also tried to set $order in the model but it didn't solve (and i
> don't want a static order anyway...)
>
> how does cakephp handle this issue?
>
> thanks to all, very much.
> >
>

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



recursive find: related models order

2009-09-24 Thread lorenx

hi all.

i'm trying to order a deeply related model but the following code
gives me an error.

$params = array(
'order' => 'RelatedModel.relatedmodel_field DESC',
'recursive' => 3
);
$models_array = $this->Model->find('all', $params);

i saw that cakephp do several queries to build $models_array and the
order parameter is appended to the first query, the one with no
RelatedModel reference.
i also tried to set $order in the model but it didn't solve (and i
don't want a static order anyway...)

how does cakephp handle this issue?

thanks to all, very much.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM Recursive Find

2009-08-14 Thread Will

Hi,

I'm attempting to make a search page with the following tables:

Chapter belongsTo Book
Book HABTM Author
Chapter HABTM Author

I'm creating the search page in the Chapters model. I want to be able
to search for chapters which belong to a book that has a particular
author (through the Book HABTM Author relation). Setting the recursive
property to 2 isn't an option as it pulls back far to much data (80
queries for a page load in some of the worst cases) and doesn't reach
far enough to get to the Author table. Any suggestions on how I could
make this work without doing a custom query?

Thanks
Will

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Containable recursive find problem

2009-06-16 Thread Andreas Derksen

Hi Wilson,
thats how my query looks like:
$checklist = $this->Checklist->find('first', array('conditions' 
=> array('Checklist.id' => $id),
   'contain' => 
array(

'Product' => array(

'fields' => array('id', 'name', 'name_short', 'year'),

'conditions' => '',

'Module.name' => array(

'Subject.description' => array(

'Check.check'

)

)
),
'Check',

'Language.lang_short', 'Language.name',

'OperatingSystem.name',

'User.name', 'User.email')));

Hope that helps :)

greets
Andreas

Wilson schrieb:
> Hi Andreas,
>
> I'm trying to this same thing, but without success.  Do you mind
> pasting your find logic here?
>
> On Jun 12, 9:20 am, Andreas Derksen  wrote:
>   
>> Thanks, Works fine! Thought to complicated... :-)
>> Containable behavior is really nice ;-)
>>
>> greets
>> Andreas
>>
>> Martin Westin schrieb:
>>
>> 
>>> You just go:
>>>   
>>> 'contain' => array(
>>>   'Product' => array(
>>> 'conditions' => array('Product.id' => $productId),
>>> 'Module' => array(
>>>   'Subject'
>>> )
>>>   ),
>>>   'Check'
>>> )
>>>   
>>> That is: in contain you simply name the nearest "associates" and in
>>> each of those you name furhter associates to return.
>>>   
>>> On Jun 12, 2:02 pm, Andreas Derksen  wrote:
>>>   
 Hi, im currently developing a checklist application witch has the 
 following Models and relations:
 Checklist belongsTo Product
 Checklist hasMany Check
 Product HABTM Module
 Module hasMany Subjects
 Subject belongsTo Module
 So, what i want to do now is to generate tables like this:Checklist ID 
 2Module 1Subject 1Subject 2Subject 3Subject 4Module 2Subject 1Subject 
 2Subject 3Subject 4
 I tried to query it like this:
 $this->Checklist->find('first', array('contain' => array(
  'Product' => 
 array('conditions' => array('Product.id' => $productId)),
  'Check' )));
 the result is:Array ( [Checklist] => Array ( [id] => 1 [product_id] => 1 ) 
 [Product] => Array ( [id] => 1 [name] => Product1 ) [Check] => Array ( [0] 
 => Array ( [id] => 1 [check] => true [checklist_id] => 1 [subject_id] => 1 
 ) ) )Now I need the Product array recursive, means: the associated 
 Module(s) and the Subject(s) associated to the Module(s).
 A $this->Checklist->find('first', array('recursive' => 2, 'conditions' => 
 array('id' => $checklistId))); returns everything I need, ... and more. 
 thats the problem.
 How can I do that?
 Thanks in advance
 Andreas
 
>> 
> >
>   

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Containable recursive find problem

2009-06-15 Thread Wilson

Hi Andreas,

I'm trying to this same thing, but without success.  Do you mind
pasting your find logic here?

On Jun 12, 9:20 am, Andreas Derksen  wrote:
> Thanks, Works fine! Thought to complicated... :-)
> Containable behavior is really nice ;-)
>
> greets
> Andreas
>
> Martin Westin schrieb:
>
> > You just go:
>
> > 'contain' => array(
> >   'Product' => array(
> >     'conditions' => array('Product.id' => $productId),
> >     'Module' => array(
> >       'Subject'
> >     )
> >   ),
> >   'Check'
> > )
>
> > That is: in contain you simply name the nearest "associates" and in
> > each of those you name furhter associates to return.
>
> > On Jun 12, 2:02 pm, Andreas Derksen  wrote:
>
> >> Hi, im currently developing a checklist application witch has the 
> >> following Models and relations:
> >> Checklist belongsTo Product
> >> Checklist hasMany Check
> >> Product HABTM Module
> >> Module hasMany Subjects
> >> Subject belongsTo Module
> >> So, what i want to do now is to generate tables like this:Checklist ID 
> >> 2Module 1Subject 1Subject 2Subject 3Subject 4Module 2Subject 1Subject 
> >> 2Subject 3Subject 4
> >> I tried to query it like this:
> >> $this->Checklist->find('first', array('contain' => array(
> >>                                                              'Product' => 
> >> array('conditions' => array('Product.id' => $productId)),
> >>                                                              'Check' )));
> >> the result is:Array ( [Checklist] => Array ( [id] => 1 [product_id] => 1 ) 
> >> [Product] => Array ( [id] => 1 [name] => Product1 ) [Check] => Array ( [0] 
> >> => Array ( [id] => 1 [check] => true [checklist_id] => 1 [subject_id] => 1 
> >> ) ) )Now I need the Product array recursive, means: the associated 
> >> Module(s) and the Subject(s) associated to the Module(s).
> >> A $this->Checklist->find('first', array('recursive' => 2, 'conditions' => 
> >> array('id' => $checklistId))); returns everything I need, ... and more. 
> >> thats the problem.
> >> How can I do that?
> >> Thanks in advance
> >> Andreas
>
>
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Containable recursive find problem

2009-06-12 Thread Andreas Derksen

Thanks, Works fine! Thought to complicated... :-)
Containable behavior is really nice ;-)

greets
Andreas

Martin Westin schrieb:
> You just go:
>
> 'contain' => array(
>   'Product' => array(
> 'conditions' => array('Product.id' => $productId),
> 'Module' => array(
>   'Subject'
> )
>   ),
>   'Check'
> )
>
> That is: in contain you simply name the nearest "associates" and in
> each of those you name furhter associates to return.
>
>
>
> On Jun 12, 2:02 pm, Andreas Derksen  wrote:
>   
>> Hi, im currently developing a checklist application witch has the following 
>> Models and relations:
>> Checklist belongsTo Product
>> Checklist hasMany Check
>> Product HABTM Module
>> Module hasMany Subjects
>> Subject belongsTo Module
>> So, what i want to do now is to generate tables like this:Checklist ID 
>> 2Module 1Subject 1Subject 2Subject 3Subject 4Module 2Subject 1Subject 
>> 2Subject 3Subject 4
>> I tried to query it like this:
>> $this->Checklist->find('first', array('contain' => array(
>>  'Product' => 
>> array('conditions' => array('Product.id' => $productId)),
>>  'Check' )));
>> the result is:Array ( [Checklist] => Array ( [id] => 1 [product_id] => 1 ) 
>> [Product] => Array ( [id] => 1 [name] => Product1 ) [Check] => Array ( [0] 
>> => Array ( [id] => 1 [check] => true [checklist_id] => 1 [subject_id] => 1 ) 
>> ) )Now I need the Product array recursive, means: the associated Module(s) 
>> and the Subject(s) associated to the Module(s).
>> A $this->Checklist->find('first', array('recursive' => 2, 'conditions' => 
>> array('id' => $checklistId))); returns everything I need, ... and more. 
>> thats the problem.
>> How can I do that?
>> Thanks in advance
>> Andreas
>> 
> >
>   

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Containable recursive find problem

2009-06-12 Thread Martin Westin

You just go:

'contain' => array(
  'Product' => array(
'conditions' => array('Product.id' => $productId),
'Module' => array(
  'Subject'
)
  ),
  'Check'
)

That is: in contain you simply name the nearest "associates" and in
each of those you name furhter associates to return.



On Jun 12, 2:02 pm, Andreas Derksen  wrote:
> Hi, im currently developing a checklist application witch has the following 
> Models and relations:
> Checklist belongsTo Product
> Checklist hasMany Check
> Product HABTM Module
> Module hasMany Subjects
> Subject belongsTo Module
> So, what i want to do now is to generate tables like this:Checklist ID 
> 2Module 1Subject 1Subject 2Subject 3Subject 4Module 2Subject 1Subject 
> 2Subject 3Subject 4
> I tried to query it like this:
> $this->Checklist->find('first', array('contain' => array(
>                                                              'Product' => 
> array('conditions' => array('Product.id' => $productId)),
>                                                          'Check' )));
> the result is:Array ( [Checklist] => Array ( [id] => 1 [product_id] => 1 ) 
> [Product] => Array ( [id] => 1 [name] => Product1 ) [Check] => Array ( [0] => 
> Array ( [id] => 1 [check] => true [checklist_id] => 1 [subject_id] => 1 ) ) 
> )Now I need the Product array recursive, means: the associated Module(s) and 
> the Subject(s) associated to the Module(s).
> A $this->Checklist->find('first', array('recursive' => 2, 'conditions' => 
> array('id' => $checklistId))); returns everything I need, ... and more. thats 
> the problem.
> How can I do that?
> Thanks in advance
> Andreas
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Containable recursive find problem

2009-06-12 Thread Andreas Derksen





Hi, im currently developing a checklist application witch has the
following Models and relations:

Checklist belongsTo Product
Checklist hasMany Check
Product HABTM Module
Module hasMany Subjects
Subject belongsTo Module

So, what i want to do now is to generate tables like this:

Checklist ID 2

  

  Module 1
  


  Subject 1
  


  Subject 2
  


  Subject 3 
  


  Subject 4
  

  



  

  Module 2
  


  Subject 1
  


  Subject 2
  


  Subject 3 
  


  Subject 4
  

  


I tried to query it like this: 
$this->Checklist->find('first', array('contain' => array(
                                                             'Product'
=> array('conditions' => array('Product.id' => $productId)),
                                                         'Check'
)));

the result is:

Array
(
[Checklist] => Array
(
[id] => 1
[product_id] => 1
)

[Product] => Array
(
[id] => 1
[name] => Product1
)

[Check] => Array
(
[0] => Array
(
[id] => 1
[check] => true
[checklist_id] => 1
[subject_id] => 1
)

)

)

Now I need the Product array recursive, means: the associated Module(s)
and the Subject(s) associated to the Module(s).

A $this->Checklist->find('first', array('recursive' => 2,
'conditions' => array('id' => $checklistId))); returns everything
I need, ... and more. thats the problem.

How can I do that?

Thanks in advance
Andreas


--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com  For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---





problem with recursive find

2009-04-21 Thread Sebastian

Hey guys,

I have the following model-relationship:

Event <---HABTM> Artist <---HABTM--> Genre

Now, in my events.index view I'd like to list all events, each with
its artists, each with its genres. With pagination my index controller
function looks as follows:

$this->Event->recursive = 2;
$this->Event->order = 'Event.date, Event.start';
$this->paginate = array('limit'=>25);
$this->set('events', $this->paginate(array('Event.public'=>'1',
'Event.date>=NOW()')));

In my index View I loop through $events, then do an addional loop for
all artists of the event:

foreach ($event['Artist'] as $artist) {
  echo $artist['name'];
  /// <--print genres here
}

This all works fine, except for the part where I want to print the
genres for each artist. I tried the following (in the loop above):

foreach (($artist['Genre']) as $genre) {
  echo $genre['name'];
}

This works fine for the first event. However, for the second event in
the list, the genres are printed twice (e.g. "Rock - Rock"), in the
third event they are ouput 3 times ("Rock - Rock - Rock"), and so
on

What am I missing here?

Regards,

Sebastian
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-15 Thread francky06l

Set recursive to 2  just a hint

On Oct 14, 5:46 am, squidliberty <[EMAIL PROTECTED]> wrote:
> That worked! The only problem is that it creates a ton of queries...
> instead of just LEFT JOIN ing the Shift table into the select query,
> CakePHP is issuing a separate query for each related Shift record. In
> addition to being inefficient, this means that I can't use Shift
> fields in my condition, fields, or order values :(
>
> I guess I should just write a custom query and skip bypass Cake's
> database abstraction.
>
> Thanks for all your help!
>
> - Scott
>
> On Oct 13, 6:11 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > I faced the same problem. It seems there is a (recent bug) bug in
> > containable (I use the SVN branch). It does not adjust the recursive
> > properly.
> > Try you query adding 'recursive' =>  3 and that should do it..
>
> > hth
>
> > On Oct 13, 7:58 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > Did you check the generated query ? Does it contain the shifts table?
>
> > > On Oct 13, 4:43 am, squidliberty <[EMAIL PROTECTED]> wrote:
>
> > > > As an experiment, I downloaded a fresh copy of Cake 1.2 and added only
> > > > the scripts above. I wanted to confirm that this was not a problem
> > > > caused by my existing site's configuration. The new installation
> > > > produced identical results, so there must be something wrong with the
> > > > approach. Maybe I'm just overlooking something obvious...
> > > > - Scott
>
> > > > On Oct 12, 5:44 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > > After reading again the post
>
> > > > > $this->find('all', array(
> > > > > 'contain' => array(
> > > > > 'Department', 'Sale' => 'Shift(closed)'),
> > > > > 'fields' => array('Log.cost')
> > > > > ),
> > > > > );
>
> > > > > Hope this works, I did not catch all relations at first glance, you
> > > > > might also use the containable behaviors in the Sale / Departement
> > > > > model ..
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-13 Thread squidliberty

That worked! The only problem is that it creates a ton of queries...
instead of just LEFT JOIN ing the Shift table into the select query,
CakePHP is issuing a separate query for each related Shift record. In
addition to being inefficient, this means that I can't use Shift
fields in my condition, fields, or order values :(

I guess I should just write a custom query and skip bypass Cake's
database abstraction.

Thanks for all your help!

- Scott


On Oct 13, 6:11 am, francky06l <[EMAIL PROTECTED]> wrote:
> I faced the same problem. It seems there is a (recent bug) bug in
> containable (I use the SVN branch). It does not adjust the recursive
> properly.
> Try you query adding 'recursive' =>  3 and that should do it..
>
> hth
>
> On Oct 13, 7:58 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > Did you check the generated query ? Does it contain the shifts table?
>
> > On Oct 13, 4:43 am, squidliberty <[EMAIL PROTECTED]> wrote:
>
> > > As an experiment, I downloaded a fresh copy of Cake 1.2 and added only
> > > the scripts above. I wanted to confirm that this was not a problem
> > > caused by my existing site's configuration. The new installation
> > > produced identical results, so there must be something wrong with the
> > > approach. Maybe I'm just overlooking something obvious...
> > > - Scott
>
> > > On Oct 12, 5:44 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > After reading again the post
>
> > > > $this->find('all', array(
> > > >         'contain' => array(
> > > >                 'Department', 'Sale' => 'Shift(closed)'),
> > > >         'fields' => array('Log.cost')
> > > >         ),
> > > > );
>
> > > > Hope this works, I did not catch all relations at first glance, you
> > > > might also use the containable behaviors in the Sale / Departement
> > > > model ..
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-13 Thread francky06l

I faced the same problem. It seems there is a (recent bug) bug in
containable (I use the SVN branch). It does not adjust the recursive
properly.
Try you query adding 'recursive' =>  3 and that should do it..

hth

On Oct 13, 7:58 am, francky06l <[EMAIL PROTECTED]> wrote:
> Did you check the generated query ? Does it contain the shifts table?
>
> On Oct 13, 4:43 am, squidliberty <[EMAIL PROTECTED]> wrote:
>
> > As an experiment, I downloaded a fresh copy of Cake 1.2 and added only
> > the scripts above. I wanted to confirm that this was not a problem
> > caused by my existing site's configuration. The new installation
> > produced identical results, so there must be something wrong with the
> > approach. Maybe I'm just overlooking something obvious...
> > - Scott
>
> > On Oct 12, 5:44 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > After reading again the post
>
> > > $this->find('all', array(
> > > 'contain' => array(
> > > 'Department', 'Sale' => 'Shift(closed)'),
> > > 'fields' => array('Log.cost')
> > > ),
> > > );
>
> > > Hope this works, I did not catch all relations at first glance, you
> > > might also use the containable behaviors in the Sale / Departement
> > > model ..
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-12 Thread francky06l

Did you check the generated query ? Does it contain the shifts table?

On Oct 13, 4:43 am, squidliberty <[EMAIL PROTECTED]> wrote:
> As an experiment, I downloaded a fresh copy of Cake 1.2 and added only
> the scripts above. I wanted to confirm that this was not a problem
> caused by my existing site's configuration. The new installation
> produced identical results, so there must be something wrong with the
> approach. Maybe I'm just overlooking something obvious...
> - Scott
>
> On Oct 12, 5:44 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > After reading again the post
>
> > $this->find('all', array(
> > 'contain' => array(
> > 'Department', 'Sale' => 'Shift(closed)'),
> > 'fields' => array('Log.cost')
> > ),
> > );
>
> > Hope this works, I did not catch all relations at first glance, you
> > might also use the containable behaviors in the Sale / Departement
> > model ..
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-12 Thread squidliberty

As an experiment, I downloaded a fresh copy of Cake 1.2 and added only
the scripts above. I wanted to confirm that this was not a problem
caused by my existing site's configuration. The new installation
produced identical results, so there must be something wrong with the
approach. Maybe I'm just overlooking something obvious...
- Scott


On Oct 12, 5:44 pm, francky06l <[EMAIL PROTECTED]> wrote:
> After reading again the post
>
> $this->find('all', array(
>         'contain' => array(
>                 'Department', 'Sale' => 'Shift(closed)'),
>         'fields' => array('Log.cost')
>         ),
> );
>
> Hope this works, I did not catch all relations at first glance, you
> might also use the containable behaviors in the Sale / Departement
> model ..
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-12 Thread squidliberty

Hmmm... that seems to yield the same results (no Shift data). Also I
tried adding containable to the Sale and Shift models but that didn't
seem to make any difference. Any other ideas? Is there some other
method to achieve the desired result?

Thanks again!
Scott

On Oct 12, 5:44 pm, francky06l <[EMAIL PROTECTED]> wrote:
> After reading again the post
>
> $this->find('all', array(
>         'contain' => array(
>                 'Department', 'Sale' => 'Shift(closed)'),
>         'fields' => array('Log.cost')
>         ),
> );
>
> Hope this works, I did not catch all relations at first glance, you
> might also use the containable behaviors in the Sale / Departement
> model ..
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-12 Thread francky06l

After reading again the post

$this->find('all', array(
'contain' => array(
'Department', 'Sale' => 'Shift(closed)'),
'fields' => array('Log.cost')
),
);

Hope this works, I did not catch all relations at first glance, you
might also use the containable behaviors in the Sale / Departement
model ..

On Oct 12, 11:02 pm, squidliberty <[EMAIL PROTECTED]> wrote:
> Thanks for the speedy response! Unfortunately, that doesn't return any
> data from the Shift model. I guess 'fields' overrides 'contain'?
> - Scott
>
> On Oct 12, 4:20 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > Probably:
>
> > $this->find('all', array(
> > 'contain' => array(
> > 'Department',
> > 'Sale',
> > 'Sale' => array('Shift(closed)')
> > ),
> > 'fields' => array('Log.cost'),
> > ));
>
> > hth
>
> > On Oct 12, 9:50 pm, squidliberty <[EMAIL PROTECTED]> wrote:
>
> > > I have three models: Shift, Sale and Log that are related using
> > > CakePHP associations (see model definitions below). I want to find
> > > logs and return their associated sale and the sale's associated shift.
> > > But I'm having a hard time with this...
>
> > > $this->find('all', array(
> > > 'contain' => array(
> > > 'Department',
> > > 'Sale',
> > > 'Sale' => array('Shift')
> > > ),
> > > 'fields' => array('Shift.closed', 'Log.cost'),
> > > ));
>
> > > Any idea why this produces "SQL Error: 1054: Unknown column
> > > 'Shift.closed' in 'field list'? Where am I going wring? Any advice
> > > would be appreciated! I've also tried using recursive instead of
> > > contain, but had similar results.
>
> > > Models:
> > > class Log extends AppModel {
> > > var $name = 'Log';
> > > var $belongsTo = array('Department', 'Sale');
> > > var $actsAs = array('Containable');}
>
> > > ...
> > > class Sale extends AppModel {
> > > var $name = 'Sale';
> > > var $belongsTo = array('Shift');
> > > var $hasMany = array('Log');}
>
> > > ...
> > > class Shift extends AppModel {
> > > var $name = 'Shift';
> > > var $hasMany = array('Sale');
>
> > > }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-12 Thread squidliberty

Thanks for the speedy response! Unfortunately, that doesn't return any
data from the Shift model. I guess 'fields' overrides 'contain'?
- Scott


On Oct 12, 4:20 pm, francky06l <[EMAIL PROTECTED]> wrote:
> Probably:
>
> $this->find('all', array(
>         'contain' => array(
>                 'Department',
>                 'Sale',
>                 'Sale' => array('Shift(closed)')
>         ),
>         'fields' => array('Log.cost'),
> ));
>
> hth
>
> On Oct 12, 9:50 pm, squidliberty <[EMAIL PROTECTED]> wrote:
>
> > I have three models: Shift, Sale and Log that are related using
> > CakePHP associations (see model definitions below). I want to find
> > logs and return their associated sale and the sale's associated shift.
> > But I'm having a hard time with this...
>
> > $this->find('all', array(
> >         'contain' => array(
> >                 'Department',
> >                 'Sale',
> >                 'Sale' => array('Shift')
> >         ),
> >         'fields' => array('Shift.closed', 'Log.cost'),
> > ));
>
> > Any idea why this produces "SQL Error: 1054: Unknown column
> > 'Shift.closed' in 'field list'? Where am I going wring? Any advice
> > would be appreciated! I've also tried using recursive instead of
> > contain, but had similar results.
>
> > Models:
> > class Log extends AppModel {
> >         var $name = 'Log';
> >         var $belongsTo = array('Department', 'Sale');
> >         var $actsAs = array('Containable');}
>
> > ...
> > class Sale extends AppModel {
> >         var $name = 'Sale';
> >         var $belongsTo = array('Shift');
> >         var $hasMany = array('Log');}
>
> > ...
> > class Shift extends AppModel {
> >         var $name = 'Shift';
> >         var $hasMany = array('Sale');
>
> > }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-12 Thread francky06l

Probably:

$this->find('all', array(
'contain' => array(
'Department',
'Sale',
'Sale' => array('Shift(closed)')
),
'fields' => array('Log.cost'),
));

hth

On Oct 12, 9:50 pm, squidliberty <[EMAIL PROTECTED]> wrote:
> I have three models: Shift, Sale and Log that are related using
> CakePHP associations (see model definitions below). I want to find
> logs and return their associated sale and the sale's associated shift.
> But I'm having a hard time with this...
>
> $this->find('all', array(
> 'contain' => array(
> 'Department',
> 'Sale',
> 'Sale' => array('Shift')
> ),
> 'fields' => array('Shift.closed', 'Log.cost'),
> ));
>
> Any idea why this produces "SQL Error: 1054: Unknown column
> 'Shift.closed' in 'field list'? Where am I going wring? Any advice
> would be appreciated! I've also tried using recursive instead of
> contain, but had similar results.
>
> Models:
> class Log extends AppModel {
> var $name = 'Log';
> var $belongsTo = array('Department', 'Sale');
> var $actsAs = array('Containable');}
>
> ...
> class Sale extends AppModel {
> var $name = 'Sale';
> var $belongsTo = array('Shift');
> var $hasMany = array('Log');}
>
> ...
> class Shift extends AppModel {
> var $name = 'Shift';
> var $hasMany = array('Sale');
>
> }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Recursive find()

2008-10-12 Thread squidliberty

I have three models: Shift, Sale and Log that are related using
CakePHP associations (see model definitions below). I want to find
logs and return their associated sale and the sale's associated shift.
But I'm having a hard time with this...

$this->find('all', array(
'contain' => array(
'Department',
'Sale',
'Sale' => array('Shift')
),
'fields' => array('Shift.closed', 'Log.cost'),
));

Any idea why this produces "SQL Error: 1054: Unknown column
'Shift.closed' in 'field list'? Where am I going wring? Any advice
would be appreciated! I've also tried using recursive instead of
contain, but had similar results.

Models:
class Log extends AppModel {
var $name = 'Log';
var $belongsTo = array('Department', 'Sale');
var $actsAs = array('Containable');
}
...
class Sale extends AppModel {
var $name = 'Sale';
var $belongsTo = array('Shift');
var $hasMany = array('Log');
}
...
class Shift extends AppModel {
var $name = 'Shift';
var $hasMany = array('Sale');
}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Selective Recursive Find

2007-12-11 Thread Adam Royle

I guess it depends on how you choose to develop. Personally I keep a
separate copy of cake for every single site that I create. This means
I don't have to worry about backwards compatibility for each site
every time I want to use a new version of cake. Some people who are
using *nix might use a technique like this:
http://realm3.com/articles/managing_multiple_versions_of_cakephp_on_linux

Each time I create a new site, I export a version from the trunk
repository in subversion. If my previous code (controllers,
behaviours, helpers, etc) doesn't work with the latest trunk I figure
out what is causing the conflict. If it's too hard to debug I just use
a previous working version (copied from another site).

If I have to modify an older site and I want some functionality that I
have in the new version, I usually just swap out the cake directory
with the latest version and then test the site thoroughly. If there
are no errors, sweet! If there are, I usually restore the previous
cake folder and see if I can get the functionality by overriding a
class, or sometimes I'll just modify the cake core libs (not generally
recommended unless you know what you're doing and don't care that it
might upset a god somewhere).

So all in all, not a very streamlined process, but as a sole developer
doing the above doesn't concern me.

Re: your comment about saving datetime fields. Not sure what
functionality you're talking about that no longer works - but it might
just work differently. Dig through the source and figure out how it
works. And yes, you do occasionally find bugs, but that's the fun of
open source - you can fix them and send a patch back to the
developers :)

Additionally, one of the first steps I do when using a new version of
cake is to bake some controllers, models and views to see if anything
major has changed. Also helps to identify new features occasionally.

Cheers,
Adam

On Dec 12, 12:52 am, Baz <[EMAIL PROTECTED]> wrote:
> Slightly.
>
> Sorry, I'm new to all of this. I just realized that I need some software to
> download from the branches.
>
> I do have a question though. What do you do when you update and stuff
> doesn't work, just roll back?
>
> For eg. Saving datetime fields to the database no longer works.
>
> On Dec 11, 2007 4:02 AM, Adam Royle <[EMAIL PROTECTED]> wrote:
>
>
>
> > Baz...
>
> > I update to the 1.2.x.x trunk every so often and use for production
> > sites. It's generally considered stable enough to use.
> >https://svn.cakephp.org/repo/trunk/cake/1.2.x.x
>
> > I also have the 1.2.x.x branch repository checked out from:
> >https://svn.cakephp.org/repo/branches/1.2.x.x
>
> > I generally only check this folder whenever I find a bug and want to
> > see if it has been fixed or not. I also use this repository it to
> > submit patches to trac.
>
> > Hope that clears things up.
>
> > Cheers,
> > Adam
>
> > On Dec 11, 1:48 am, Baz <[EMAIL PROTECTED]> wrote:
> > > I came across the bindable stuffHere's my issue though:
>
> > > With these bindables, you need and SVN version of CakePHP.
> > > - I'm still not sure how to download ONE SPECIFIC version of this (All I
> > can
> > > get is the latest nightly).
> > > - Last time I tried the nightly, it screwed up some stuff for me due to
> > some
> > > changes that I wasn't prepared for.
>
> > > On Dec 10, 2007 8:11 AM, Serge Rodovnichenko <[EMAIL PROTECTED]> wrote:
>
> > > > For Cake 1.2 take a look at Containable behaviour
> > > >http://www.thinkingphp.org/2007/06/14/containable-20-beta/orBindable
> > > > behaviour (I prefer it! :-) :http://cake-syrup.sourceforge.net/
>
> > > > For cake 1.1 search this group for keyword 'expects' :-)
>
> > > > On Dec 10, 4:24 pm, Baz <[EMAIL PROTECTED]> wrote:
> > > > > I have a simple question (I think).
>
> > > > > I have a model (Requests), which has a lot of relationships
> > including 3
> > > > > belongsTo (Equipment, Classroom, Department).
> > > > > The Classroom model has a belongsTo (Building).
>
> > > > > I'm doing a findAll/paginate in the Request controller with
> > > > > $this->Request->recursive = 1 and get MOST of what I need. However,
> > I'm
> > > > > trying to tack onto that, the Building reference.
>
> > > > > I've tried this:
> > > > > $this->Request->Classroom->recursive = 2;
>
> > > > > To just set the recursive set to 2 on the Classroom model only
> > (Doesn't
> > > > > work).
>
> > > > > I've tried doing a $this->Request->Classroom->bindModel(.)
> > > > > Doesn't work.
>
> > > > > What does work is:
> > > > > $this->Request->recursive = 2, however I get a whole recursive mess
> > on
> > > > the
> > > > > other models (Eqiupment, Department). Then I have to go unbind ALL
> > the
> > > > other
> > > > > stuff I don't need.
>
> > > > > Is there a shortcut here? I just wanna change the recursiveness on
> > ONE
> > > > > associated model.
>
> > > > > Please ask for details if I'm unclear:
> > > > > --
> > > > > Baz L
> > > > > Web Development 2.0: Web Design, CakePHP,
> > > > Javascripthttp:/

Re: Selective Recursive Find

2007-12-11 Thread Baz
Slightly.

Sorry, I'm new to all of this. I just realized that I need some software to
download from the branches.

I do have a question though. What do you do when you update and stuff
doesn't work, just roll back?

For eg. Saving datetime fields to the database no longer works.

On Dec 11, 2007 4:02 AM, Adam Royle <[EMAIL PROTECTED]> wrote:

>
> Baz...
>
> I update to the 1.2.x.x trunk every so often and use for production
> sites. It's generally considered stable enough to use.
> https://svn.cakephp.org/repo/trunk/cake/1.2.x.x
>
> I also have the 1.2.x.x branch repository checked out from:
> https://svn.cakephp.org/repo/branches/1.2.x.x
>
> I generally only check this folder whenever I find a bug and want to
> see if it has been fixed or not. I also use this repository it to
> submit patches to trac.
>
> Hope that clears things up.
>
> Cheers,
> Adam
>
> On Dec 11, 1:48 am, Baz <[EMAIL PROTECTED]> wrote:
> > I came across the bindable stuffHere's my issue though:
> >
> > With these bindables, you need and SVN version of CakePHP.
> > - I'm still not sure how to download ONE SPECIFIC version of this (All I
> can
> > get is the latest nightly).
> > - Last time I tried the nightly, it screwed up some stuff for me due to
> some
> > changes that I wasn't prepared for.
> >
> > On Dec 10, 2007 8:11 AM, Serge Rodovnichenko <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > For Cake 1.2 take a look at Containable behaviour
> > >http://www.thinkingphp.org/2007/06/14/containable-20-beta/or Bindable
> > > behaviour (I prefer it! :-) :http://cake-syrup.sourceforge.net/
> >
> > > For cake 1.1 search this group for keyword 'expects' :-)
> >
> > > On Dec 10, 4:24 pm, Baz <[EMAIL PROTECTED]> wrote:
> > > > I have a simple question (I think).
> >
> > > > I have a model (Requests), which has a lot of relationships
> including 3
> > > > belongsTo (Equipment, Classroom, Department).
> > > > The Classroom model has a belongsTo (Building).
> >
> > > > I'm doing a findAll/paginate in the Request controller with
> > > > $this->Request->recursive = 1 and get MOST of what I need. However,
> I'm
> > > > trying to tack onto that, the Building reference.
> >
> > > > I've tried this:
> > > > $this->Request->Classroom->recursive = 2;
> >
> > > > To just set the recursive set to 2 on the Classroom model only
> (Doesn't
> > > > work).
> >
> > > > I've tried doing a $this->Request->Classroom->bindModel(.)
> > > > Doesn't work.
> >
> > > > What does work is:
> > > > $this->Request->recursive = 2, however I get a whole recursive mess
> on
> > > the
> > > > other models (Eqiupment, Department). Then I have to go unbind ALL
> the
> > > other
> > > > stuff I don't need.
> >
> > > > Is there a shortcut here? I just wanna change the recursiveness on
> ONE
> > > > associated model.
> >
> > > > Please ask for details if I'm unclear:
> > > > --
> > > > Baz L
> > > > Web Development 2.0: Web Design, CakePHP,
> > > Javascripthttp://www.WebDevelopment2.com/
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Selective Recursive Find

2007-12-11 Thread Adam Royle

Baz...

I update to the 1.2.x.x trunk every so often and use for production
sites. It's generally considered stable enough to use.
https://svn.cakephp.org/repo/trunk/cake/1.2.x.x

I also have the 1.2.x.x branch repository checked out from:
https://svn.cakephp.org/repo/branches/1.2.x.x

I generally only check this folder whenever I find a bug and want to
see if it has been fixed or not. I also use this repository it to
submit patches to trac.

Hope that clears things up.

Cheers,
Adam

On Dec 11, 1:48 am, Baz <[EMAIL PROTECTED]> wrote:
> I came across the bindable stuffHere's my issue though:
>
> With these bindables, you need and SVN version of CakePHP.
> - I'm still not sure how to download ONE SPECIFIC version of this (All I can
> get is the latest nightly).
> - Last time I tried the nightly, it screwed up some stuff for me due to some
> changes that I wasn't prepared for.
>
> On Dec 10, 2007 8:11 AM, Serge Rodovnichenko <[EMAIL PROTECTED]> wrote:
>
>
>
> > For Cake 1.2 take a look at Containable behaviour
> >http://www.thinkingphp.org/2007/06/14/containable-20-beta/or Bindable
> > behaviour (I prefer it! :-) :http://cake-syrup.sourceforge.net/
>
> > For cake 1.1 search this group for keyword 'expects' :-)
>
> > On Dec 10, 4:24 pm, Baz <[EMAIL PROTECTED]> wrote:
> > > I have a simple question (I think).
>
> > > I have a model (Requests), which has a lot of relationships including 3
> > > belongsTo (Equipment, Classroom, Department).
> > > The Classroom model has a belongsTo (Building).
>
> > > I'm doing a findAll/paginate in the Request controller with
> > > $this->Request->recursive = 1 and get MOST of what I need. However, I'm
> > > trying to tack onto that, the Building reference.
>
> > > I've tried this:
> > > $this->Request->Classroom->recursive = 2;
>
> > > To just set the recursive set to 2 on the Classroom model only (Doesn't
> > > work).
>
> > > I've tried doing a $this->Request->Classroom->bindModel(.)
> > > Doesn't work.
>
> > > What does work is:
> > > $this->Request->recursive = 2, however I get a whole recursive mess on
> > the
> > > other models (Eqiupment, Department). Then I have to go unbind ALL the
> > other
> > > stuff I don't need.
>
> > > Is there a shortcut here? I just wanna change the recursiveness on ONE
> > > associated model.
>
> > > Please ask for details if I'm unclear:
> > > --
> > > Baz L
> > > Web Development 2.0: Web Design, CakePHP,
> > Javascripthttp://www.WebDevelopment2.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Selective Recursive Find

2007-12-10 Thread Baz
I came across the bindable stuffHere's my issue though:

With these bindables, you need and SVN version of CakePHP.
- I'm still not sure how to download ONE SPECIFIC version of this (All I can
get is the latest nightly).
- Last time I tried the nightly, it screwed up some stuff for me due to some
changes that I wasn't prepared for.


On Dec 10, 2007 8:11 AM, Serge Rodovnichenko <[EMAIL PROTECTED]> wrote:

>
> For Cake 1.2 take a look at Containable behaviour
> http://www.thinkingphp.org/2007/06/14/containable-20-beta/ or Bindable
> behaviour (I prefer it! :-) : http://cake-syrup.sourceforge.net/
>
> For cake 1.1 search this group for keyword 'expects' :-)
>
> On Dec 10, 4:24 pm, Baz <[EMAIL PROTECTED]> wrote:
> > I have a simple question (I think).
> >
> > I have a model (Requests), which has a lot of relationships including 3
> > belongsTo (Equipment, Classroom, Department).
> > The Classroom model has a belongsTo (Building).
> >
> > I'm doing a findAll/paginate in the Request controller with
> > $this->Request->recursive = 1 and get MOST of what I need. However, I'm
> > trying to tack onto that, the Building reference.
> >
> > I've tried this:
> > $this->Request->Classroom->recursive = 2;
> >
> > To just set the recursive set to 2 on the Classroom model only (Doesn't
> > work).
> >
> > I've tried doing a $this->Request->Classroom->bindModel(.)
> > Doesn't work.
> >
> > What does work is:
> > $this->Request->recursive = 2, however I get a whole recursive mess on
> the
> > other models (Eqiupment, Department). Then I have to go unbind ALL the
> other
> > stuff I don't need.
> >
> > Is there a shortcut here? I just wanna change the recursiveness on ONE
> > associated model.
> >
> > Please ask for details if I'm unclear:
> > --
> > Baz L
> > Web Development 2.0: Web Design, CakePHP,
> Javascripthttp://www.WebDevelopment2.com/
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Selective Recursive Find

2007-12-10 Thread Serge Rodovnichenko

For Cake 1.2 take a look at Containable behaviour
http://www.thinkingphp.org/2007/06/14/containable-20-beta/ or Bindable
behaviour (I prefer it! :-) : http://cake-syrup.sourceforge.net/

For cake 1.1 search this group for keyword 'expects' :-)

On Dec 10, 4:24 pm, Baz <[EMAIL PROTECTED]> wrote:
> I have a simple question (I think).
>
> I have a model (Requests), which has a lot of relationships including 3
> belongsTo (Equipment, Classroom, Department).
> The Classroom model has a belongsTo (Building).
>
> I'm doing a findAll/paginate in the Request controller with
> $this->Request->recursive = 1 and get MOST of what I need. However, I'm
> trying to tack onto that, the Building reference.
>
> I've tried this:
> $this->Request->Classroom->recursive = 2;
>
> To just set the recursive set to 2 on the Classroom model only (Doesn't
> work).
>
> I've tried doing a $this->Request->Classroom->bindModel(.)
> Doesn't work.
>
> What does work is:
> $this->Request->recursive = 2, however I get a whole recursive mess on the
> other models (Eqiupment, Department). Then I have to go unbind ALL the other
> stuff I don't need.
>
> Is there a shortcut here? I just wanna change the recursiveness on ONE
> associated model.
>
> Please ask for details if I'm unclear:
> --
> Baz L
> Web Development 2.0: Web Design, CakePHP, 
> Javascripthttp://www.WebDevelopment2.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Selective Recursive Find

2007-12-10 Thread Baz
I have a simple question (I think).

I have a model (Requests), which has a lot of relationships including 3
belongsTo (Equipment, Classroom, Department).
The Classroom model has a belongsTo (Building).

I'm doing a findAll/paginate in the Request controller with
$this->Request->recursive = 1 and get MOST of what I need. However, I'm
trying to tack onto that, the Building reference.

I've tried this:
$this->Request->Classroom->recursive = 2;

To just set the recursive set to 2 on the Classroom model only (Doesn't
work).

I've tried doing a $this->Request->Classroom->bindModel(.)
Doesn't work.

What does work is:
$this->Request->recursive = 2, however I get a whole recursive mess on the
other models (Eqiupment, Department). Then I have to go unbind ALL the other
stuff I don't need.


Is there a shortcut here? I just wanna change the recursiveness on ONE
associated model.

Please ask for details if I'm unclear:
--
Baz L
Web Development 2.0: Web Design, CakePHP, Javascript
http://www.WebDevelopment2.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Prevent double data in recursive find/findAll

2007-03-10 Thread Jon Bennett

> Thanks a lot, mate! I'll try it out.

no worries mate

when I start thinking about optimisations like this, I tend to
pr/debug the full dataset that's being returned, and then add an
unbindAll method for each model I need to tweak, though I wouldn't
worry about optimising things until the app is nearing completion.

jb


-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Prevent double data in recursive find/findAll

2007-03-10 Thread David Pärsson

Thanks a lot, mate! I'll try it out.

On Mar 9, 7:54 pm, "Jon Bennett" <[EMAIL PROTECTED]> wrote:
> > > My question is, is there a way to prevent that the same data is
> > > fetched (and added to the results array) several times, without
> > > lowering the recursion level?
>
> > check outhttp://bakery.cakephp.org/articles/view/183(or one of the
> > other variants).
>
> > What I would do is:
>
> > // set recursive level
> > $this->Group->recursive = 1;
> > // unbind all associations except the Student model
> > $this->Group->unbindAll(array('hasMany'=>array('Student')));
> > // unbind all assocations from the Student model to avoid
> > $this->Group->Student->unbindAll();
> > // grab records
> > $groups = $this->Group->findAll();
>
> I meant recursive = 2 sorry!
>
> hth
>
> jon
>
> --
>
> jon bennett
> t: +44 (0) 1225 341 039 w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Prevent double data in recursive find/findAll

2007-03-09 Thread Jon Bennett

> > My question is, is there a way to prevent that the same data is
> > fetched (and added to the results array) several times, without
> > lowering the recursion level?
>
> check out http://bakery.cakephp.org/articles/view/183 (or one of the
> other variants).
>
> What I would do is:
>
> // set recursive level
> $this->Group->recursive = 1;
> // unbind all associations except the Student model
> $this->Group->unbindAll(array('hasMany'=>array('Student')));
> // unbind all assocations from the Student model to avoid
> $this->Group->Student->unbindAll();
> // grab records
> $groups = $this->Group->findAll();

I meant recursive = 2 sorry!

hth

jon

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Prevent double data in recursive find/findAll

2007-03-09 Thread Jon Bennett

> My question is, is there a way to prevent that the same data is
> fetched (and added to the results array) several times, without
> lowering the recursion level?

check out http://bakery.cakephp.org/articles/view/183 (or one of the
other variants).

What I would do is:

// set recursive level
$this->Group->recursive = 1;
// unbind all associations except the Student model
$this->Group->unbindAll(array('hasMany'=>array('Student')));
// unbind all assocations from the Student model to avoid
$this->Group->Student->unbindAll();
// grab records
$groups = $this->Group->findAll();

hth

jon

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Prevent double data in recursive find/findAll

2007-03-09 Thread David Pärsson

Hi,

I'm creating an application where i use a lot of belongsTo and hasMany
relations. It's kind of like a school. A school has many classes and
the classes belongs to the school. Every class has many students who
belong to the school.

Now when I in my application do a findAll on, let's say, a group with
a high recursion level, i.e. 5, the main structure resulting array
looks something like this: (I'm skipping the details that doesn't
matter)

Group => array(
   Student => array(
  Group => array(
 Student => array(
...
 )
 ...
  )
  ...
   )
   ...
)

The same group and the same students are fetched several times (using
different queries). Of course, with even more models (schools,
regions, ...), the amount of data fetched grows huge! This might not
have a very big impact on performance, but it sure doesn't feel
good. :)

My question is, is there a way to prevent that the same data is
fetched (and added to the results array) several times, without
lowering the recursion level?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Using conditions with recursive find

2007-01-16 Thread anselm




On Jan 16, 2:25 pm, "Tazz" <[EMAIL PROTECTED]> wrote:

Yep I got it working with bind/unbind. Defining all the associations in
the model before hand is nice "clean", but inefficient on the find
since it will return all data for all associations.

It would be interesting to be able to define a few associations in the
model and be able to pass the association name to the find methods.



Do you know about this ?

http://bakery.cakephp.org/articles/view/185

It lets you define on the fly which associations should be queried, and
which shouldn't. So if you only want your newsletter to return Vinyl
releases, you'd do :

$this->NewsLetter->expects('VinylReleases');
$this->NewsLetter->find(...);

Anselm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Using conditions with recursive find

2007-01-16 Thread Tazz


Yep I got it working with bind/unbind. Defining all the associations in
the model before hand is nice "clean", but inefficient on the find
since it will return all data for all associations.

It would be interesting to be able to define a few associations in the
model and be able to pass the association name to the find methods.

Thanks


anselm wrote:

> Quick description of the domain/model...
>
> Working on a newsletter for a record shop...
>
> Models: Newsletter, Releases, Formats
>
> - Newsletter hasMany Releases
> - Released belongsTo Formats
>
> So basically a newsletter will display the new releases for the week
> and each release has a format such as: CD, Tape, Vinyl etc...
>
> Now I would like to split, the newsletter to only display all new
> releases on Vinyl format on the front page and the others on separate
> pages.
>
> How would I do this? Bind, unbind?

If you look in the chapter about associations
(http://manual.cakephp.org/chapter/models), you can see that an
association can have a name that is different from the classname --
that allows you to have different associations for the same table. For
each of the association you can then use the 'conditions' field to set
conditions particular to this association.

So for instance you have two associations in your NewsLetter model, one
for the vinyls and one for the other types :

var $hasMany = array(
  'VinylReleases' => array(
'className' => 'Release',
'conditions'  => 'Release.type = "vinyl"'
  ),
  'NonVinylReleases' => array(
'className' => 'Release',
'conditions' => 'Release.type <> "vinyl"'
  )
);

Now when you call

$this->NewsLetter->find(...);

This should return an array containing a field 'VinylReleases' and
another field 'NonVinylReleases' with the correct data in it.

You can add other terms to that condition -- it's SQL -- so you could
add an extra condition to get only the releases of a certain time
period. If this needs to be done on the fly, then, yes, use
bind/unbind.

Anselm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Using conditions with recursive find

2007-01-16 Thread anselm



Quick description of the domain/model...

Working on a newsletter for a record shop...

Models: Newsletter, Releases, Formats

- Newsletter hasMany Releases
- Released belongsTo Formats

So basically a newsletter will display the new releases for the week
and each release has a format such as: CD, Tape, Vinyl etc...

Now I would like to split, the newsletter to only display all new
releases on Vinyl format on the front page and the others on separate
pages.

How would I do this? Bind, unbind?


If you look in the chapter about associations
(http://manual.cakephp.org/chapter/models), you can see that an
association can have a name that is different from the classname --
that allows you to have different associations for the same table. For
each of the association you can then use the 'conditions' field to set
conditions particular to this association.

So for instance you have two associations in your NewsLetter model, one
for the vinyls and one for the other types :

var $hasMany = array(
 'VinylReleases' => array(
   'className' => 'Release',
   'conditions'  => 'Release.type = "vinyl"'
 ),
 'NonVinylReleases' => array(
   'className' => 'Release',
   'conditions' => 'Release.type <> "vinyl"'
 )
);

Now when you call

$this->NewsLetter->find(...);

This should return an array containing a field 'VinylReleases' and
another field 'NonVinylReleases' with the correct data in it.

You can add other terms to that condition -- it's SQL -- so you could
add an extra condition to get only the releases of a certain time
period. If this needs to be done on the fly, then, yes, use
bind/unbind.

Anselm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Using conditions with recursive find

2007-01-15 Thread Tazz


Quick description of the domain/model...

Working on a newsletter for a record shop...

Models: Newsletter, Releases, Formats

- Newsletter hasMany Releases
- Released belongsTo Formats

So basically a newsletter will display the new releases for the week
and each release has a format such as: CD, Tape, Vinyl etc...

Now I would like to split, the newsletter to only display all new
releases on Vinyl format on the front page and the others on separate
pages.

How would I do this? Bind, unbind?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: sorting recursive find()'s and findall()'s

2006-08-24 Thread Samuel DeVore

you can use http://cakephp.org/search?q=bindModel bindModel to set
associated ordering on demand  (hint look for cakebaker's link)

On 8/24/06, jez <[EMAIL PROTECTED]> wrote:
>
> Hi there,
> I was wondering if there's a way to sort on a foreign field when I use
> recursion in my find()'s
>
> Thanks,
> Jez.
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



sorting recursive find()'s and findall()'s

2006-08-24 Thread jez

Hi there,
I was wondering if there's a way to sort on a foreign field when I use
recursion in my find()'s

Thanks,
Jez.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Is there a way to specify what fields should be returned in a recursive find?

2006-05-20 Thread Sebastian Macias

Let say I have an artist who has many albums, and the albums have many
songs.
I want to be able to get all the the artist song titles.
Find allowes me to specify what fields should be returned, but it seems
to work only for the artists table fields no for the album and songs
fields.
Thanks in advance,
Sebastian

X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.11.53.63 with SMTP id b63mr94138cwa;
Sat, 20 May 2006 19:42:01 -0700 (PDT)
X-Google-Token: LIENAgwAAADU0_1pxKaUeisCrJJSjjk1
Received: from 69.232.72.50 by g10g2000cwb.googlegroups.com with HTTP;
Sun, 21 May 2006 02:42:01 + (UTC)
From: "Sebastian Macias" <[EMAIL PROTECTED]>
To: "Cake PHP" 
Subject: Is there a way to specify what fields should be returned in a 
recursive find?
Date: Sun, 21 May 2006 02:42:01 -
Message-ID: <[EMAIL PROTECTED]>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) 
Gecko/20060426 Firefox/1.5.0.3,gzip(gfe),gzip(gfe)
Mime-Version: 1.0
Content-Type: text/plain

Let say I have an artist who has many albums, and the albums have many
songs.
I want to be able to get all the the artist song titles.
Find allowes me to specify what fields should be returned, but it seems
to work only for the artists table fields no for the album and songs
fields.
Thanks in advance,
Sebastian


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---