/** * @ORM\PrePersist */ public function preInsert() { if ($this->fileExists()) { $this->setSize(filesize($this->getFullFilePath())); $this->setFileMd5(md5_file($this->getFullFilePath())); $this->setMimeType(finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->getFullFilePath())); } $this->dateCreate = new \Zend_Date(); $this->hash = \Extlib\Generator::generateDoctrine2($this->getEm(), get_class($this), 'hash', self::HASH_LEN); }
/** * Set password * * @param string $password * @return User */ public function setPassword($password) { $this->salt = \Extlib\Generator::generateDoctrine2($this->getEm(), get_class($this), 'salt', self::SALT_LEN); $this->password = \hash(self::PASSWORD_HASH_ALGORITHM, $password . $this->salt); return $this; }
/** * @ORM\PrePersist */ public function preInsert() { $this->dateCreate = new \Zend_Date(); $this->hash = \Extlib\Generator::generateDoctrine2($this->getEm(), get_class($this), 'hash', self::HASH_LEN); }