Headshota
Headshota

Reputation: 21449

CakePHP ACL lists, ARO alias

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?

Upvotes: 1

Views: 845

Answers (2)

Agacor
Agacor

Reputation: 21

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.

Upvotes: 2

benjamin
benjamin

Reputation: 2185

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.

Upvotes: 2

Related Questions