I've got a small question about Creating Aro-s in Cakephp
http://book.cakephp.org/#!/view/1547/Acts-As-a-Requester
I'm using code provided in cake-s tutorial (see the link), the problem i开发者_C百科s that alias for the aro-s are not set. how can this be achieved?
For the purpose of going through the tutorial quickly, you can simply set the alias using your favorite database managing program (phpMyAdmin or the like).
Edit1:
Go for the afterSave
callback in the model under concern and set the alias from there.
Add something like this in your User Model.
public function afterSave() {
$this->Aro->save(array('alias'=>$this->data[$this->alias]['name']));
}
Change 'name' by the fieldName you want to use as alias for the Aro. Same in the Group Model.
Saludos.
精彩评论