/** * @param Element $element элемент родитель * @throws Exception */ public function setParent(Element $element) { if (!$element->getChild($this) instanceof Element) { throw new Exception('Элемент должен являться потомком'); } $this->parent = $element; }
public static function create(array $data = array()) { $container = new Container(); $container->fill($data); $container->save(); $element = new Element(); $element->fill($data); $container->content()->save($element); }
public static function create(array $data = array()) { $file = new File(); $file->fill($data); $file->save(); $element = new Element(); $element->fill($data); $file->content()->save($element); }
public function search($input) { try { $elements = Element::where('name', 'LIKE', "%{$input}%")->get(); if (empty($elements)) { throw new HttpException(404, "Container not found (by container identifier)"); } return $elements; } catch (Exception $e) { echo 'Excepción capturada: ' . $e->getMessage(), "\n"; } }
/** * @return Element[] потомки в составном элементе * @throws Exception */ public function getChildren() { parent::getChildren(); // TODO: Change the autogenerated stub }
/** * Добавить условие связывания * @param Element $element созависимый элемент * @param string $condition условие при котором наступает событие */ public function addCondition(Element $element, $condition) { $this->conditions[] = [$element->getName(), $condition]; }