Exemplo n.º 1
0
 protected function insertImage($entite, $images)
 {
     foreach ($images as $type => $image) {
         foreach ($image as $format => $url) {
             $image = new Image();
             $image->setType($type)->setFormat($format)->setUrl($url);
             $this->persistAndSave($image);
             $entite->addImage($image);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * save file to db
  * @param string $file_name
  * @param string $action
  * @param bool $is_cached
  * @return integer file id
  */
 protected function saveFile($file_name, $action)
 {
     $f = new Image();
     $f->setUidType(User::typeToInt($this->auth->getType()));
     $f->setUri($this->pic_dir . $file_name);
     $f->setUid($this->auth->getUserObject()->getId());
     $f->setType(static::actionToType($action));
     $this->em->persist($f);
     $this->em->flush();
     $id = $f->getId();
     $this->em->clear();
     unset($f);
     return $id;
 }