Hello

In CakePHP 1.2 beta I do this:
<?php
class ClassifiedsController extends AppController
{
        ...
        function form(){

                if(empty($this->data))
            {
                $this->Classified->id = $id;
                $this->data = $this->Classified->read();
            }
            else
            {
                        $this->Classified->set($this->data);
                if($this->Classified->validates()){
                                $this->data['Classified']['otherfield'] = 
'test';

                                
if($this->Classified->save($this->data['Classified'])){


                                }
                        }
                }
        }
        ...
}
?>
And the field 'otherfield' is correctly saved.

With the new CakePHP 1.2 RC2, the 'otherfield' is not saved (see via
debug set to 2) and I have to do this:
<?php
class ClassifiedsController extends AppController
{
        ...
        function form(){

                if(empty($this->data))
            {
                $this->Classified->id = $id;
                $this->data = $this->Classified->read();
            }
            else
            {
                        $this->data['Classified']['otherfield'] = 'test';

                        $this->Classified->set($this->data);
                if($this->Classified->validates()){

                                
if($this->Classified->save($this->data['Classified'])){


                                }
                        }
                }
        }
        ...
}
?>
Filling the 'otherfield' before the Model::set()
I dont like this method, because I want validation before filling
other fields, and the set() method is required for validation.

How can I fill the other fields to save them after validation? (in
beforeSave?)
What changed about this in RC2?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to