Example #1
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;
 }