28 if($this->aro === NULL){
29 $this->aro = $class::model()->find(
'model = :model AND foreign_key = :foreign_key',
30 array(
':model' => get_class($this),
'foreign_key' => $this->
id));
34 if(!$this->aro && $guest){
35 $this->aro = $class::model()->find(
'alias = :alias', array(
':alias' => $guest));
39 throw new RuntimeException(
'There is no associated Aro nor a guest-group');
50 public function may($obj, $action){
52 return $this->aro->may($obj, $action);
61 public function grant($obj, $actions){
63 return $this->aro->grant($obj, $actions);
72 public function deny($obj, $actions){
74 return $this->aro->deny($obj, $actions);
84 if($this->isNewRecord){
87 $aro->model = get_class($this);
88 $aro->foreign_key = $this->getPrimaryKey();
90 throw new RuntimeError(
"Unable to save Aro-Collection");
100 $aro = $class::model()->find(
'model = :model AND foreign_key = :key', array(
':model' => get_class( $this),
':key' => $this->
id));
103 throw new RuntimeException(
'No associated Aro-Collection!');
105 $transaction = Yii::app()->db->beginTransaction();
108 $transaction->commit();
112 $transaction->rollback();