public function __construct($entity, $filter = NULL, $fields = [], $limit = 10, $alias = NULL, $order = [], $prepare_callback = NULL, $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($entity, $limit, $alias, $order, $context, $loops);
     //set default filter from classname
     if ($filter === NULL) {
         $parts = explode("\\", get_class($context ?: $this));
         $filter = Misc::underscore(array_pop($parts));
     }
     //create filterform
     $this->filterform = $this->initChild("filterform", new Form(NULL, $filter, $context, $loops));
     $this->filterform->addFromAnnotations($this->entity, $filter, $this, $loops);
     $this->filterform->onConfirm = function () {
         return FALSE;
     };
     EntityForm::enhanceFromEntity($this->filterform, $entity, $filter, $fields, $loops);
     if (is_string($prepare_callback)) {
         $prepare_callback = [$context, $prepare_callback];
     }
     if (is_callable($prepare_callback)) {
         $this->prepare_callback = $prepare_callback;
     }
 }
Example #2
0
 public function __construct($entity, $filter = ["", "update_entity"], $fields = [], $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($entity, $filter, $fields, $context, $loops);
 }
 public function __construct($entity, $filter = ["", "persist_entity"], $fields = [], $context = NULL, Loops $loops = NULL)
 {
     parent::__construct(is_string($entity) ? new $entity() : $entity, $filter, $fields, $context, $loops);
 }