cake-php@googlegroups.com
[Top] [All Lists]

Re: recursive call

Subject: Re: recursive call
From: Valter
Date: Mon, 27 Dec 2010 05:16:26 -0800 PST
Hi Amit - thanks for the reply.

I've done it but no joy. One way I made it appear in the view form was
to change the parent_id argument for parentUsers but in that case when
I tryed to insert another record the parent_id column gets a null
value. Another information that I should've mentioned is that instead
of using the baked code (showed in the original message) if I use
scafold it works just fine. Any other thoghts?? - thanks again.

On Dec 27, 2:51 am, Amit Badkas <amit.sanis...@xxxxxxxxx> wrote:
> Hi,
>
> The form helper judges the options of a select field according to the
> section of field name before '_id'. For example, it uses $departments if
> field name is 'department_id', so try to set variable name as 'parents'
> instead of 'parentUsers'.
>
> Hope this helps.
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.com
>
>
>
> On Sun, Dec 26, 2010 at 4:34 AM, Valter <valterjdeso...@xxxxxxxxx> wrote:
> > All,
>
> > I a newbie to cake and need your expert help. I've created a db schema
> > then baked it (used cake naming convention all the way). See below the
> > schema:
>
> > users {id(PK), name, lastname, username, password, email,
> > department_id(FK), parent_id(FK)**}
>
> > **parent_id refers to the users table recursively (a user can
> > supervise another user). When I bake it to create all the CRUD
> > functions It seems to work fine but then when I try to ADD a new user
> > the drop down menu do not populate itself with the data I entered
> > manually in the database.
>
> > Funily enough, when I debug() the parentUsers table generated by cake,
> > it returns the values I was expecting in the dropdown element.
>
> > See the bake generated code below:
>
> > thanks
>
> > ********** View*************
> > <?php
> >   debug($parentUsers);
> >   echo $this->Form->input('name');
> >   echo $this->Form->input('last_name');
> >   echo $this->Form->input('username');
> >   echo $this->Form->input('password');
> >   echo $this->Form->input('email');
> >   echo $this->Form->input('department_id');
> >   echo $this->Form->input('parent_id');
> > ?>
> > ****************************
>
> > ********** Controller *************
> > .
> >   $departments = $this->User->Department->find('list');
> >   $parentUsers = $this->User->ParentUser->find('list');
> >   $this->set(compact('departments', 'parentUsers'));
> > .
> > .
> > .****************************
> > ********** Model *************
> > var $belongsTo = array(
> > 'ParentUser' => array(
> >        'className' => 'User',
> >        'foreignKey' => 'parent_id',
> >        'conditions' => '',
> >        'fields' => '',
> >        'order' => ''
> >        )
> > );
>
> > ***************************
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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@xxxxxxxxxxxxxxxx
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@xxxxxxxxxxxxxxxx<cake-php%2Bunsubscribe@xxxxxxxxxxxxxx­om>For
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en- Hide quoted text -
>
> - Show quoted text -

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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

<Prev in Thread] Current Thread [Next in Thread>