public function deleteAttachmentByUrl($url) { $attch = $this->attachmentDao->findAttachmentByFileName(trim(basename($url))); if ($attch != NULL) { if (OW::getStorage()->fileExists($this->getAttachmentsDir() . $attch->getFileName())) { OW::getStorage()->removeFile($this->getAttachmentsDir() . $attch->getFileName()); } $this->attachmentDao->delete($attch); } else { if (OW::getStorage()->fileExists($this->getAttachmentsDir() . basename($url))) { OW::getStorage()->removeFile($this->getAttachmentsDir() . basename($url)); } } }