开发者

CakePHP ACL lists, ARO alias

开发者 https://www.devze.com 2023-02-14 19:54 出处:网络
I\'ve got a small question about Creating Aro-s in Cakephp http://book.cakephp.org/#!/view/1547/Acts-As-a-Requester

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消