1
votes

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 is that alias for the aro-s are not set. how can this be achieved?

2

2 Answers

2
votes

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.

2
votes

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.