Hi,
Thanks for response
Status model has relationship with two tables "projects" and "tasks".
both relationships are one two many (one status can have many projects
and tasks)
here is status model (I have followed cake convention)
class Status extends AppModel {
var $name = 'Status';
//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $hasMany = array(
'Project' => array(
'className' => 'Project',
'foreignKey' => 'status_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Task' => array(
'className' => 'Task',
'foreignKey' => 'status_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
}
Yes, the tables have conventional structure...
Strangly, the problem is only with stauses table..(I can not modify
anything in status table...even when I edit projects, I can not change
their status with always shows as 1 =not started.
I am not very familiar with CakePHP...please help..
Regards,
Vijay
On Aug 24, 9:07 pm, DavidH <[email protected]> wrote:
> I guess there's some relationship between Tasks Projects and Statuses
> because the SQL you're reproduced here shows what's being selected
> from the related models not from the statuses model. Does anything get
> selected from statuses at all?
>
> What does your statuses model look like?
>
> Do the underlying tables have conventional structures, I.e. id for the
> primary key and table_id for the foreign keys?
>
> David
>
> On Aug 24, 3:56 pm, Vijay Pandey <[email protected]> wrote:
>
> > Hi !
>
> > I have a little problem with edit function...I have developed a small
> > application to manage projects. Every project has a status...there are
> > totoal 5 statuses..I want to change the name of 5th status but I can
> > not do it...no matter which "status" I select to "edit" it always
> > displays status 1 for editing...
>
> > Here is the url
>
> > localhost/myapp/statuses/edit/4
>
> > and here is what it did:
>
> > SELECT `Project`.`id`, `Project`.`name`, `Project`.`description`,
> > `Project`.`status_id`, `Project`.`created`, `Project`.`modified` FROM
> > `projects` AS `Project` WHERE `Project`.`status_id` = (1)
>
> > SELECT `Task`.`id`, `Task`.`project_id`, `Task`.`name`,
> > `Task`.`description`, `Task`.`status_id`, `Task`.`created`,
> > `Task`.`modified` FROM `tasks` AS `Task` WHERE `Task`.`status_id` =
> > (1)
>
> > (i got this beacuse I have kept debug variable on )
>
> > What to do? this problem is only with "ststuses" only...all other
> > edits are working fine...
>
> > Here are other information
>
> > statuses_controller.php
>
> > function edit($id = null) {
> > if (!$id && empty($this->data)) {
> > $this->Session->setFlash(__('Invalid Status',
> > true));
> > $this->redirect(array('action'=>'index'));
> > }
> > if (!empty($this->data)) {
> > if ($this->Status->save($this->data)) {
> > $this->Session->setFlash(__('The Status has
> > been saved', true));
> > $this->redirect(array('action'=>'index'));
> > } else {
> > $this->Session->setFlash(__('The Status
> > could not be saved.
> > Please, try again.', true));
> > }
> > }
> > if (empty($this->data)) {
> > $this->data = $this->Status->read(null,$id);
> > }
> > }
>
> > edit.ctp file
>
> > <?php echo $form->create('Status');?>
> > <fieldset>
> > <legend><?php __('Edit Status');?></legend>
> > <?php
> > echo $form->input('id');
> > echo $form->input('name');
> > ?>
> > </fieldset>
> > <?php echo $form->end('Submit');?>
>
> > default.ctp file
>
> > <body>
> > <div id="container">
> > <div id="content">
>
> > <?php $session->flash(); ?>
>
> > <?php echo $content_for_layout; ?>
>
> > </div>
> > <div id="footer">
>
> > </div>
> > </div>
> > <?php echo $cakeDebug; ?>
> > </body>
>
> > Please enlighten me why this strange thing is happening...
>
> > regards,
>
> > Vijai
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---