public function manage($hookType, dmDoctrineRecord $record)
 {
     if ($record instanceof dmRecordPermission && 'DmRecordPermission' === $record->get('secure_model')) {
         $permPermRecord = $record->getTable()->find($record->get('secure_record'));
         if ('DmRecordPermission' === $permPermRecord->get('secure_model')) {
             return;
             //don't go over 3 levels of permission of permission, crazy boy !
         }
     }
     $security = $record->getDmModule()->getOption('security', false);
     if (is_array($security)) {
         foreach ($security as $app => $appConfig) {
             if (!is_array($appConfig)) {
                 continue;
             }
             foreach ($appConfig as $actionKind => $actionsConfig) {
                 if (!is_array($actionsConfig)) {
                     continue;
                 }
                 foreach ($actionsConfig as $actionName => $actionConfig) {
                     if (!is_array($actionConfig)) {
                         continue;
                     }
                     if (isset($actionConfig['strategy']) && in_array($actionConfig['strategy'], array('record', 'mixed'))) {
                         $method = 'manage' . ucfirst($hookType);
                         if (method_exists($this, $method)) {
                             $this->{$method}($record, $actionName, $actionConfig, $app);
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
 public function execute(dmDoctrineRecord $record)
 {
     $this->record = $record;
     $this->table = $record->getTable();
     //    $this->record->clearRelated();
     foreach ($this->getLoremizableColumns() as $columnName => $column) {
         $this->loremizeColumn($columnName, $column);
     }
     if ($this->getOption('create_associations')) {
         $this->loremizeAssociations();
     }
     return $this->record;
 }
Beispiel #3
0
 public function addModifiedRecord(dmDoctrineRecord $record)
 {
     if ($record instanceof DmAutoSeo) {
         $table = $record->getTargetDmModule()->getTable();
     } else {
         $table = $record->getTable();
     }
     if ($table instanceof dmDoctrineTable) {
         if (!isset($this->modifiedTables[$table->getComponentName()]) && $table->interactsWithPageTree()) {
             $this->addModifiedTable($table);
         }
     }
     return $this;
 }