Ejemplo n.º 1
0
 /**
  * @param Element $element элемент родитель
  * @throws Exception
  */
 public function setParent(Element $element)
 {
     if (!$element->getChild($this) instanceof Element) {
         throw new Exception('Элемент должен являться потомком');
     }
     $this->parent = $element;
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 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";
     }
 }
Ejemplo n.º 5
0
Archivo: Field.php Proyecto: ouk/forms
 /**
  * @return Element[] потомки в составном элементе
  * @throws Exception
  */
 public function getChildren()
 {
     parent::getChildren();
     // TODO: Change the autogenerated stub
 }
Ejemplo n.º 6
0
 /**
  * Добавить условие связывания
  * @param Element $element созависимый элемент
  * @param string $condition условие при котором наступает событие
  */
 public function addCondition(Element $element, $condition)
 {
     $this->conditions[] = [$element->getName(), $condition];
 }