/** * @param \Product\Entity\Product|Post $entity */ public function addEntityInfo($entity) { $this->writer->startElement('url'); $this->writer->writeElement('lastmod', date(\Datetime::ATOM, time())); $this->writer->startElement('image:image'); if ($entity instanceof Post) { $this->writer->writeElement('image:loc', "http://www.infolightingco.com/images/posts/" . $entity->getThumbnail()); $this->writer->writeElement('loc', "http://www.infolightingco.com/news/" . $entity->getUrl()); } else { $this->writer->writeElement('image:loc', "http://www.infolightingco.com/images/posts/" . $entity->getThumbnail()); $this->writer->writeElement('loc', "http://www.infolightingco.com/products/view/" . $entity->getProductNumber()); } $this->writer->endElement(); $this->writer->endElement(); }
private function deleteImages(PostEntity $entity) { if ($thumbnail = $entity->getThumbnail()) { FileUtilService::deleteFile(FileUtilService::getFilePath($thumbnail, 'posts', 'public/images')); foreach (PostEntity::$thumbnailVariations as $key => $variation) { $variationImg = $entity->getThumbnail($key); FileUtilService::deleteFile(FileUtilService::getFilePath($variationImg, 'posts', 'public/images')); } } }