protected function save($tmp_name) { $info = $this->getInfo($tmp_name); $img = new Image(); $img->setSize(filesize($tmp_name)); $img->setHeight($info[1]); $img->setWidth($info[0]); $img->setType($img->getTypeFromImagesizeConst($info[2])); $this->_em->persist($img); $this->_em->flush(); if (rename($tmp_name, $this->generateFileName($img->getId(), $img->getType()))) { $this->last_image = $img; return true; } else { $this->_errors[] = 'Image save error!'; return false; } }
public function setCreateDate(\DateTime $createDate) { $this->__load(); return parent::setCreateDate($createDate); }