From aeb1f49c350c4bacd7527fbb3a7a89d952da3823 Mon Sep 17 00:00:00 2001 From: Leny BERNARD Date: Sat, 28 Apr 2018 00:31:03 +0200 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=91=B7=20CircleCI=20requirement=20:?= =?UTF-8?q?=20use=207.1.9=20php=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index a8a6427..cfed390 100644 --- a/circle.yml +++ b/circle.yml @@ -7,7 +7,7 @@ machine: services: - redis php: - version: 7.0.4 + version: 7.0.9 dependencies: override: From 1f208dd70e43e3b56273f0f3e72192b7d674970e Mon Sep 17 00:00:00 2001 From: Leny BERNARD Date: Sat, 28 Apr 2018 00:31:15 +0200 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=91=B7=20CircleCI=20requirement=20:?= =?UTF-8?q?=20use=207.1.9=20php=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index cfed390..b4ead22 100644 --- a/circle.yml +++ b/circle.yml @@ -7,7 +7,7 @@ machine: services: - redis php: - version: 7.0.9 + version: 7.1.9 dependencies: override: From 27046ebdd898de4d4499de871609bd253260ef25 Mon Sep 17 00:00:00 2001 From: Baptiste Date: Thu, 24 Jan 2019 09:59:31 +0100 Subject: [PATCH 3/6] fix typo --- Entity/AbstractVacuumRelationHistory.php | 2 +- Entity/VacuumXMLRelationHistory.php | 4 ++-- Utils/History/XMLHistoryManager.php | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Entity/AbstractVacuumRelationHistory.php b/Entity/AbstractVacuumRelationHistory.php index 98afe35..f23341c 100644 --- a/Entity/AbstractVacuumRelationHistory.php +++ b/Entity/AbstractVacuumRelationHistory.php @@ -11,7 +11,7 @@ * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="type", type="string") * @ORM\DiscriminatorMap({ - * "xml" = "Victoire\DevTools\VacuumBundle\Entity\VacuumXMlRelationHistory" + * "xml" = "Victoire\DevTools\VacuumBundle\Entity\VacuumXMLRelationHistory" * }) * @ORM\Table("vic_vacuum_historic") */ diff --git a/Entity/VacuumXMLRelationHistory.php b/Entity/VacuumXMLRelationHistory.php index 87eaae4..7340093 100644 --- a/Entity/VacuumXMLRelationHistory.php +++ b/Entity/VacuumXMLRelationHistory.php @@ -36,7 +36,7 @@ public function getTagName() /** * @param string $tagName * - * @return VacuumXMlRelationHistory + * @return VacuumXMLRelationHistory */ public function setTagName(string $tagName) { @@ -56,7 +56,7 @@ public function getTagId() /** * @param int $tagId * - * @return VacuumXMlRelationHistory + * @return VacuumXMLRelationHistory */ public function setTagId(int $tagId) { diff --git a/Utils/History/XMLHistoryManager.php b/Utils/History/XMLHistoryManager.php index 815aa83..3a07beb 100644 --- a/Utils/History/XMLHistoryManager.php +++ b/Utils/History/XMLHistoryManager.php @@ -4,7 +4,7 @@ use Doctrine\ORM\EntityManager; use Victoire\DevTools\VacuumBundle\Entity\AbstractVacuumRelationHistory; -use Victoire\DevTools\VacuumBundle\Entity\VacuumXMlRelationHistory; +use Victoire\DevTools\VacuumBundle\Entity\VacuumXMLRelationHistory; use Victoire\DevTools\VacuumBundle\Entity\WordPress\AbstractXMLEntity; use Victoire\DevTools\VacuumBundle\Utils\History\Exception\XMLHistoryException; @@ -16,7 +16,7 @@ class XMLHistoryManager implements HistoryManagerInterface private $entityManager; /** - * @var array|\Victoire\DevTools\VacuumBundle\Entity\VacuumXMlRelationHistory[] + * @var array|\Victoire\DevTools\VacuumBundle\Entity\VacuumXMLRelationHistory[] */ private $histories; @@ -38,7 +38,7 @@ public function reload() { unset($this->histories); $this->histories = $this->entityManager - ->getRepository('VictoireVacuumBundle:VacuumXMlRelationHistory') + ->getRepository('VictoireVacuumBundle:VacuumXMLRelationHistory') ->findAll(); } @@ -46,7 +46,7 @@ public function reload() * @param AbstractXMLEntity $source * @param $vicClass * - * @return mixed|null|VacuumXMlRelationHistory + * @return mixed|null|VacuumXMLRelationHistory */ public function searchHistory(AbstractXMLEntity $source, $vicClass) { @@ -87,11 +87,11 @@ public function getVicEntity(AbstractVacuumRelationHistory $history) * @param AbstractXMLEntity $source * @param $refined * - * @return VacuumXMlRelationHistory + * @return VacuumXMLRelationHistory */ public function generateHistory(AbstractXMLEntity $source, $refined) { - $history = new VacuumXMlRelationHistory(); + $history = new VacuumXMLRelationHistory(); $history->setTagId($source->getId()); $history->setTagName($source->getXmlTag()); $history->setVicClass(get_class($refined)); @@ -104,9 +104,9 @@ public function generateHistory(AbstractXMLEntity $source, $refined) /** * @param $entity - * @param VacuumXMlRelationHistory $history + * @param VacuumXMLRelationHistory $history */ - public function flushHistory($entity, VacuumXMlRelationHistory $history) + public function flushHistory($entity, VacuumXMLRelationHistory $history) { $this->entityManager->persist($entity); $this->entityManager->flush(); From 067a22a9381ac02a218a52f74ba1b180d284c616 Mon Sep 17 00:00:00 2001 From: Baptiste Date: Thu, 24 Jan 2019 11:11:57 +0100 Subject: [PATCH 4/6] Use victoire_core.user_class rather than static classname --- Pipeline/WordPress/IOWordPressPipeline.php | 11 +++++++++-- .../Stages/Author/AuthorDataExtractorStages.php | 16 ++++++++++++++-- Resources/config/services.yml | 1 + 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Pipeline/WordPress/IOWordPressPipeline.php b/Pipeline/WordPress/IOWordPressPipeline.php index d44cc2f..2c5c158 100644 --- a/Pipeline/WordPress/IOWordPressPipeline.php +++ b/Pipeline/WordPress/IOWordPressPipeline.php @@ -62,6 +62,11 @@ class IOWordPressPipeline */ private $XMLHistoryManager; + /** + * @var string + */ + private $userClass; + /** * IOWordPressPipeline constructor. * @@ -72,13 +77,15 @@ public function __construct( $kernelRootDir, MediaFormater $mediaFormater, CurlsTools $curlsTools, - XMLHistoryManager $XMLHistoryManager + XMLHistoryManager $XMLHistoryManager, + $vicUserClassPath ) { $this->entityManager = $entityManager; $this->kernelRootDir = $kernelRootDir; $this->mediaFormater = $mediaFormater; $this->curlsTools = $curlsTools; $this->XMLHistoryManager = $XMLHistoryManager; + $this->userClass = $vicUserClassPath; } /** @@ -102,7 +109,7 @@ public function preparePipeline($commandParameter, OutputInterface $output, Ques $pipeline ->pipe(new BlogDataExtractorStages()) - ->pipe(new AuthorDataExtractorStages($this->entityManager)) + ->pipe((new AuthorDataExtractorStages($this->entityManager))->setUserClass($this->userClass)) ->pipe(new CategoryDataExtractorStages()) ->pipe(new TagDataExtractorStages()) ->pipe(new VicBlogGeneratorStages($this->entityManager)) diff --git a/Pipeline/WordPress/Stages/Author/AuthorDataExtractorStages.php b/Pipeline/WordPress/Stages/Author/AuthorDataExtractorStages.php index dd4551f..d0cfcac 100644 --- a/Pipeline/WordPress/Stages/Author/AuthorDataExtractorStages.php +++ b/Pipeline/WordPress/Stages/Author/AuthorDataExtractorStages.php @@ -19,6 +19,11 @@ class AuthorDataExtractorStages implements PersisterStageInterface */ private $entityManager; + /** + * @var String + */ + private $userClass; + /** * AuthorDataExtractorStages constructor. * @@ -29,6 +34,13 @@ public function __construct(EntityManager $entityManager) $this->entityManager = $entityManager; } + public function setUserClass(string $userClass) + { + $this->userClass = $userClass; + + return $this; + } + /** * Look for every Author in the dump, inside current db. * If there is no match, it throw an error and ask for creation of author @@ -52,8 +64,8 @@ public function __invoke(CommandPayloadInterface $payload) foreach ($channel->author as $wpAuthor) { $email = $xmlDataFormater->formatString('author_email', $wpAuthor); - $authorByUsername = $this->entityManager->getRepository('AppBundle:User\User')->findOneBy(['username' => $email]); - $authorByEmail = $this->entityManager->getRepository('AppBundle:User\User')->findOneBy(['email' => $email]); + $authorByUsername = $this->entityManager->getRepository($this->userClass)->findOneBy(['username' => $email]); + $authorByEmail = $this->entityManager->getRepository($this->userClass)->findOneBy(['email' => $email]); if (empty($authorByUsername) && empty($authorByEmail)) { $row = [ diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 98d9353..708a031 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -19,6 +19,7 @@ services: - "@victoire.vacuum_bundle.media_formater.utils" - "@victoire.vacuum_bundle.curl_tools.utils" - "@victoire.vacuum_bundle.xml_history_manager.utils" + - "%victoire_core.user_class%" ############################ #### UTILS From 2a023d7931c58933b6d768383cda0b7b9188e6dd Mon Sep 17 00:00:00 2001 From: Baptiste Date: Fri, 25 Jan 2019 09:36:37 +0100 Subject: [PATCH 5/6] fix Victoire BlogCategory classname --- .../Stages/Category/VicCategoryGeneratorStages.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Pipeline/WordPress/Stages/Category/VicCategoryGeneratorStages.php b/Pipeline/WordPress/Stages/Category/VicCategoryGeneratorStages.php index 289d354..bc0b4f9 100644 --- a/Pipeline/WordPress/Stages/Category/VicCategoryGeneratorStages.php +++ b/Pipeline/WordPress/Stages/Category/VicCategoryGeneratorStages.php @@ -3,7 +3,7 @@ namespace Victoire\DevTools\VacuumBundle\Pipeline\WordPress\Stages\Category; use Doctrine\ORM\EntityManager; -use Victoire\Bundle\BlogBundle\Entity\Category; +use Victoire\Bundle\BlogBundle\Entity\BlogCategory; use Victoire\DevTools\VacuumBundle\Payload\CommandPayloadInterface; use Victoire\DevTools\VacuumBundle\Pipeline\PersisterStageInterface; @@ -44,10 +44,10 @@ public function __invoke(CommandPayloadInterface $payload) $history = $payload->getXMLHistoryManager()->searchHistory($plCategory, Category::class); if (null == $history) { - $category = new Category(); + $category = new BlogCategory(); $category->setTitle($plCategory->getCategoryName()); $category->setSlug($plCategory->getCategoryNiceName()); - $payload->getNewVicBlog()->addCategorie($category); + $payload->getNewVicBlog()->addCategory($category); $history = $payload->getXMLHistoryManager()->generateHistory($plCategory, $category); $payload->getXMLHistoryManager()->flushHistory($category, $history); $progress->advance(); From c1181887e5a520a3f55265ed38d5cd1f4943195d Mon Sep 17 00:00:00 2001 From: Baptiste Date: Fri, 25 Jan 2019 11:16:04 +0100 Subject: [PATCH 6/6] q2E3wP --- Pipeline/WordPress/Stages/Author/AuthorDataExtractorStages.php | 2 +- Utils/History/XMLHistoryManager.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Pipeline/WordPress/Stages/Author/AuthorDataExtractorStages.php b/Pipeline/WordPress/Stages/Author/AuthorDataExtractorStages.php index d0cfcac..9c98384 100644 --- a/Pipeline/WordPress/Stages/Author/AuthorDataExtractorStages.php +++ b/Pipeline/WordPress/Stages/Author/AuthorDataExtractorStages.php @@ -20,7 +20,7 @@ class AuthorDataExtractorStages implements PersisterStageInterface private $entityManager; /** - * @var String + * @var string */ private $userClass; diff --git a/Utils/History/XMLHistoryManager.php b/Utils/History/XMLHistoryManager.php index 3a07beb..c62d648 100644 --- a/Utils/History/XMLHistoryManager.php +++ b/Utils/History/XMLHistoryManager.php @@ -77,6 +77,7 @@ public function getVicEntity(AbstractVacuumRelationHistory $history) $history->getVicId(), $history->getVicClass() ); + throw new XMLHistoryException($message); }