private function processAdminBackgroundImage($event) { $file = $event->getFile(); $config = $event->getConfig(); if (!$file instanceof File) { throw new \Exception('Not instance of File'); } $fileDir = str_replace($this->container->get('kernel')->getRootDir() . '/../web', "", $config['storage']['directory']); $image = new Background(); $image->setName($file->getFilename()); $image->setPath($fileDir . "/" . $file->getFilename()); $em = $this->container->get('doctrine')->getManager(); $em->persist($image); $em->flush(); }
/** * {@inheritDoc} */ public function setPath($path) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setPath', array($path)); return parent::setPath($path); }