Beispiel #1
0
 /**
  * @param Model|ActiveRecordInterface $model
  * @return array list of variation models in format: behaviorName => Model[]
  */
 protected function findVariationModelBatches($model)
 {
     $variationModels = [];
     foreach ($model->getBehaviors() as $name => $behavior) {
         if (empty($this->variationNames) && $behavior instanceof VariationBehavior || in_array($name, $this->variationNames)) {
             $variationModels[$name] = $behavior->getVariationModels();
         }
     }
     return $variationModels;
 }
Beispiel #2
0
 /**
  * @param Model|ActiveRecordInterface $model
  * @return array list of variation models in format: behaviorName => Model[]
  */
 private function findRoleModels($model)
 {
     $roleModels = [];
     foreach ($model->getBehaviors() as $name => $behavior) {
         if (empty($this->roleNames) && $behavior instanceof \yii2tech\ar\role\RoleBehavior || in_array($name, $this->roleNames)) {
             $roleModels[$name] = $behavior->getRoleRelationModel();
         }
     }
     return $roleModels;
 }