Wednesday, July 4, 2012

add 2 records in i18n for a new record

hi
i want to add a multiple lines (ita & eng) in i18n for one record in jewel
so i add a afterSave in model
cause i want to add multiple lines only for a new record and not for a modify one

i add this

public function afterSave($created) {
if ($created) {
if (isset ($this->data['Jewel']['eng'])) {
               $this->Jewel->locale = $this->data['Jewel']['eng'];
       }
       if (!empty($this->data)) {
               if ($this->Jewel>save($this->data)) {
                       $this->flash('Article been saved.', '/articles');
               }
       }
}
return true;
}


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: