Re: Are reflexive relation impossible with CakePHP ?

2008-02-22 Thread manish

But as much I know about findAllThreaded(), it is only used to find
All data from tables joined to themselves. As written in API
documentation for findAllThreaded; Special findAll variation for
tables joined to themselves. The table needs the fields id and
parent_id to work. Though I have not used this method myself yet this
is what I have found from many other sources as well.

But the thing is fetching associated data to other models and not the
associated data within the table.

On Feb 22, 11:54 am, rtconner [EMAIL PROTECTED] wrote:
 why not just use findAllThreaded() ?
--~--~-~--~~~---~--~~
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: Are reflexive relation impossible with CakePHP ?

2008-02-21 Thread b logica

How much RAM have you allocated to PHP? I have a feeling that Cake was
looping infinitely. If PHP had enough RAM I think it's possible that
the server would just keep going until Apache pooped out (as opposed
to PHP terminating that process with a msg about running out of
allocated memory).

Just a guess.

On Tue, Feb 19, 2008 at 6:41 AM, DJ Spark [EMAIL PROTECTED] wrote:

   I had the same issue, and was quite hard to spot.
   Bake always gave me a 'Parent' relationship name, and when I loaded
  anything related to that , apache crashed... no log, no debug could
  find it :)

   So, watch out, every relation made with parent_id should be double checked:
  var $hasMany = array(
'Parent' = array('className' = 'Person', 'foreignKey' = 'parent_id')
   );


  Should be:
  var $hasMany = array(
'ParentPerson' = array('className' = 'Person', 'foreignKey' = 
 'parent_id')
   );


   Spark



  On Feb 19, 2008 7:16 AM, zeugme [EMAIL PROTECTED] wrote:
  
   It solve the problem.
  
   Thanks a lot.
  
   CakePHP power !!!
  
  
   grigri wrote:
Try changing the alias ($hasMany key):
   
class Person extends AppModel {
  var $hasMany = array(
'SomeOtherAlias' = array('className' = 'Person', 'foreignKey' =
'parent_id')
  );
}
   
On Feb 19, 9:37 am, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
   
I've implemented several reflexive relations and never had a problem,
but then I always kept recursive down. I don't see any other possible
cause.
   
On Feb 19, 11:30 am, zeugme [EMAIL PROTECTED] wrote:
   
   
Hi the list !
   
I have a serious issue, a crash, when I try to set up a zero or more
relationship from Person to Person.
   
My Person table has several column and one called parent_id designed to
contain a Person identifier.
   
I did try
   
var $hasMany = array(
'Person' = array (
'className' = 'Person',
'foreignKey' = 'parent_id',
//'recursive' = '2')
);
   
with or without
* recursive
* the corresponding belongsto
   
I also try to change the design for a joint able and 
 $hasAndBelongsToMany
with or without recursive.
   
= no way ! I always got a crash from Apache log !
   
child pid 383 exit signal Segmentation fault (11)
   
Even without any data, I got a crash.
I'm scaffolding, this may be important to know.
   
I'm now totally lost. Could that be a bug in CakePHP ?
   
Are reflexive relationship impossible/forbidden to define in a Model ?
   
OK, I could hack that by making this relation on the fly, but I do want
to set that statically in the model, the normal way ...
so I can benefit all that Cake power : scaffolding, bake and quick DB
mapping.
   
Thanks for your ideas, help, ...
   

   
   
  
  
   
  



  --
  [livesets] http://djspark.com.br/
  [web] http://sydi.net
  [filmes] http://melhoresfilmes.com.br



  


--~--~-~--~~~---~--~~
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: Are reflexive relation impossible with CakePHP ?

2008-02-21 Thread b logica

On Wed, Feb 20, 2008 at 4:13 AM, manish [EMAIL PROTECTED] wrote:

  I have also been getting problems of associations not working for me
  sometimes, while some other times associations work perfectly. I have
  some questions regarding associations. I hope I am doing no wrong by
  continuing this thread and not starting a new one:

  1. Is there no way at all to check why my associations are not
  working,
  because nothing is shown in debugging. If association is not working,
  it will simply be out of your SQL, giving no clue?

I wish I knew that as well.

  2. How important is the name of the key?As mentioned above by DJ Spark
   Can the name of keys be the reason my associations are not Working?

Maybe, with a good chance of probably.

  3. What is the logic behind naming the key? DJ Spark above mentioned
  that
  that key name should be ParentPerson rather than Parent. I did not
  understand
  the logic of naming here.

Because Cake needs some way to keep them separate or the logic
wouldn't work. ParentPerson is just an alias so that Person-Person
associations can be dealt with internally. Parent is appended to the
associated model name to make it obvious which model it's the parent
of. Imagine that you were dealing with  4 models, 2 of which were
reflexively-associated with the other 2. By using ParentModelName
everything is crystal clear.

--~--~-~--~~~---~--~~
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: Are reflexive relation impossible with CakePHP ?

2008-02-21 Thread rtconner

why not just use findAllThreaded() ?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---