Friday, June 5, 2015

stocker un tableau avec l'option serialize() cakephp

Bonjour,

est ce que quelqu'un peut m aidé pour stocker un tableau qui contient une colonne date par mois et des lignes de type d'absence , j'utilise cakephp , j'ai réussie de stocker une seul colonne, mais j'arrive pas de stocker tout le tableau . merci

voila mon code de mon controleur 

public function edit($id = null) {
if (!$this->Clas->exists($id)) {
throw new NotFoundException(__('Invalid clas'));
}
if ($this->request->is(array('post', 'put'))) {
if ($this->Clas->saveAll($this->request->data)) {
$_POST['data']['Clas']= mysql_escape_string(serialize($_POST['data']['Clas']));
        var_dump($_POST['data']['Clas']);
$this->Session->setFlash(__('The clas has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
debug($this->request->data);
$this->Session->setFlash(__('The clas could not be saved. Please, try again.'));
}
} else {
$options = array('conditions' => array('Clas.' . $this->Clas->primaryKey => $id));
$this->request->data = $this->Clas->find('first', $options);
}
}

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: