filterEntity() public method

Filter an object based on its annotations
public filterEntity ( object $object )
$object object
 /**
  * Listens to the Post Bind event and triggers filtering if adequate.
  *
  * POST_SUBMIT is fired for every level of the form, from fields to
  * embedded forms. this method will filter any level that returns an
  * entity, or will only filter the root entity if 'cascade_filter'
  * is set to false.
  *
  * @param FormEvent $event
  */
 public function onPostSubmit(FormEvent $event)
 {
     $form = $event->getForm();
     if (!$form->isRoot() && !$this->getRootFormCascadeOption($form)) {
         return;
     }
     $clientData = $form->getData();
     if (!is_object($clientData)) {
         return;
     }
     $this->filterService->filterEntity($clientData);
 }
Ejemplo n.º 2
0
 /**
  * Listens to the Post Bind event and triggers filtering if adequate.
  *
  * @param FilterDataEvent $event
  */
 public function onPostBind($event)
 {
     $form = $event->getForm();
     if (!$form->isRoot()) {
         return;
     }
     $clientData = $event->getForm()->getData();
     if (!is_object($clientData)) {
         return;
     }
     $this->filterService->filterEntity($clientData);
 }