/** * @param \Sgdoce\Model\Entity\ArtefatoImagem $artefatoImagemEntity * @return void */ private function _fillFileInfromation(ArtefatoImagemEntity $artefatoImagemEntity, $filename) { if (!file_exists($filename)) { throw new \Core_Exception_ServiceLayer('Problema ao encontrar o arquivo'); } $hash = hash_file(self::HASH_ALGORITHM, $filename); $md5 = md5($hash); $artefatoImagemEntity->setTxHash($hash); $artefatoImagemEntity->setNoArquivo($md5); }
/** * monta o path de destino da imagem processada * * @param \Sgdoce\Model\Entity\ArtefatoImagem $artefatoImagemEntity * @return string */ private function _getDestinationPath(ArtefatoImagemEntity $artefatoImagemEntity) { $etiquetaNupSiorgEntity = $artefatoImagemEntity->getSqArtefato()->getNuDigital(); $loteFolder = (string) $etiquetaNupSiorgEntity->getSqLoteEtiqueta()->getSqLoteEtiqueta(); $digitalFolder = (string) $etiquetaNupSiorgEntity->getNuEtiqueta(); return sprintf('upload%1$simagem%1$s%2$s%1$s%3$s%1$s', DIRECTORY_SEPARATOR, $loteFolder, $digitalFolder); }