/**
  * Transforms a string (number) to an object (issue).
  *
  * @param  string $value
  * @return \File|null
  */
 public function reverseTransform($value)
 {
     if (!$value) {
         return null;
     }
     return $this->admin_loader->getAdminByClass($this->entity_class)->getObjectById($value);
 }
 /**
  * Transforms a string (number) to an object (issue).
  *
  * @param  string $value
  * @return object|null
  */
 public function reverseTransform($value)
 {
     if (empty($value)) {
         return null;
     }
     $this->admin_loader = $this->container->get('sf.admin.loader');
     $admin = $this->admin_loader->getAdminByClass($this->entity_class);
     return $admin->getRepository()->find($value);
 }
 /**
  * Transforms an object (issue) to a string (number).
  *
  * @param  object|null $value
  * @return string
  */
 public function transform($value)
 {
     if (!$value) {
         return 0;
     }
     if (!is_object($value)) {
         return $value;
     }
     $admin = $this->admin_loader->getAdminByClass($this->entity_class);
     return $admin->getId($value);
 }
 public function setReverseData($object, $property)
 {
     if (!$this->admin_loader) {
         $this->admin_loader = $this->container->get('sf.admin.loader');
     }
     $this->plain_property = $property;
     $this->entity_class = get_class($object);
     $admin = $this->admin_loader->getAdminByClass($this->entity_class);
     $this->salt_value = $admin->getReflectionProperty($this->salt_property)->getValue($object);
     $this->password_value = $admin->getReflectionProperty($this->password_property)->getValue($object);
     $this->object_hash = spl_object_hash($object);
 }
Example #5
0
 public function onUpdate(Controller $controller, Request $request, ActionCache $action, $object, \Symfony\Component\Form\Form $form)
 {
     if ($this->copy_properties) {
         $em = $this->getManager();
         foreach ($this->copy_properties as $property_name => $config) {
             $prop = $this->getReflectionProperty($property_name);
             $value = $prop->getValue($object);
             // \Dev::dump($value);
             $admin = $this->admin_loader->getAdminByClass(get_class($value));
             foreach ($config as $from_property => $to_property) {
                 $from_prod = $this->getReflectionProperty($from_property);
                 $to_prop = $admin->getReflectionProperty($to_property);
                 $to_prop->setValue($value, $from_prod->getValue($object));
             }
             // \Dev::dump($value); exit;
             $em->persist($value);
         }
     }
 }
 public function sf_class($admin_class)
 {
     return $this->admin_loader->getAdminByClass($admin_class);
 }
 public function setReverseData($data)
 {
     $admin = $this->admin_loader->getAdminByClass($this->admin_class);
     $this->reverse_data = $admin->getObjectOwner($data);
 }
 public function __construct(\Symforce\AdminBundle\Compiler\Loader\RouteCacheLoader $page_loader, \Symforce\AdminBundle\Compiler\Loader\AdminLoader $loader)
 {
     $this->page_loader = $page_loader;
     $this->loader = $loader;
     $this->admin = $loader->getAdminByClass($this->admin_class);
     if (!$this->route_path) {
         $this->route_path = $this->admin_name;
     }
     if ($this->page_parent_entity) {
         $this->parent_admin = $loader->getAdminByClass($this->page_parent_entity);
     }
     if ($this->controller) {
         $controller_entity_name = preg_replace('/\\\\Controller\\\\(\\w+)Controller$/', '\\\\Entity\\\\\\1', $this->controller);
         if ($this->loader->hasAdminClass($controller_entity_name)) {
             $this->controller_admin_name = $this->loader->getAdminByClass($controller_entity_name)->getName();
         }
     }
     $this->eneity_id_name = $this->admin_name . '_id';
     /*
     $this->page_loader->addFileResource( $this->admin->getReflectionClass()->getFileName() ) ;
     */
 }