Пример #1
0
 /**
  * Prepare action for use
  * @param $action TAction
  * @param $object Data Object
  */
 private function prepareAction(TAction $action, $object)
 {
     $field = $action->getField();
     if (is_null($field)) {
         throw new Exception(AdiantiCoreTranslator::translate('Field for action ^1 not defined', $label) . '.<br>' . AdiantiCoreTranslator::translate('Use the ^1 method', 'setField' . '()') . '.');
     }
     if (!isset($object->{$field})) {
         throw new Exception(AdiantiCoreTranslator::translate('Field ^1 not exists', $field));
     }
     // get the object property that will be passed ahead
     $key = isset($object->{$field}) ? $object->{$field} : NULL;
     $action->setParameter('key', $key);
 }