Skip to content

Commit

Permalink
Merge pull request #113 from CommonGateway/feature/GW-1596/Symfony-up…
Browse files Browse the repository at this point in the history
…dates

Limit corebundle to 2.0
  • Loading branch information
WilcoLouwerse authored Mar 15, 2024
2 parents 8a3cf18 + be535bf commit 69d9068
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"minimum-stability" : "dev",
"require": {
"php": ">=7.4",
"commongateway/corebundle": ">=1.1.30",
"common-gateway/brp-bundle": ">=0.1.4",
"common-gateway/klanten-bundle": ">=0.1.3",
"common-gateway/zgw-bundle": ">=0.1.34",
"commongateway/corebundle": "^1.1.30 | <2.0",
"common-gateway/brp-bundle": "^0.1.4 | <1.0",
"common-gateway/klanten-bundle": "^0.1.3 | <1.0",
"common-gateway/zgw-bundle": "^0.1.34 | <2.0",
"moneyphp/money": "3.3.3",
"symfony/sendinblue-mailer": ">=5.3.14"
},
Expand Down
42 changes: 30 additions & 12 deletions src/Service/InstallationService.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

// src/Service/InstallationService.php

namespace CommonGateway\HuwelijksplannerBundle\Service;

use App\Entity\Entity;
Expand All @@ -12,15 +11,21 @@

class InstallationService implements InstallerInterface
{

private EntityManagerInterface $entityManager;

private ContainerInterface $container;

private SymfonyStyle $io;


public function __construct(EntityManagerInterface $entityManager, ContainerInterface $container)
{
$this->entityManager = $entityManager;
$this->container = $container;
}
$this->container = $container;

}//end __construct()


/**
* Set symfony style in order to output to the console.
Expand All @@ -34,22 +39,29 @@ public function setStyle(SymfonyStyle $io): self
$this->io = $io;

return $this;
}

}//end setStyle()


public function install()
{
$this->checkDataConsistency();
}

}//end install()


public function update()
{
$this->checkDataConsistency();
}

}//end update()


public function uninstall()
{
// Do some cleanup
}
}//end uninstall()


/**
* This function sets the max depth of all entities to 5.
Expand All @@ -62,7 +74,8 @@ public function setEntityMaxDepth()
foreach ($entities as $entity) {
// Unsets the persist of the availability entity and molly entity.
if ($entity->getReference() === 'https://huwelijksplanner.nl/schemas/hp.mollie.schema.json'
|| $entity->getReference() === 'https://huwelijksplanner.nl/schemas/hp.availability.schema.json') {
|| $entity->getReference() === 'https://huwelijksplanner.nl/schemas/hp.availability.schema.json'
) {
$entity->setPersist(false);
$this->entityManager->persist($entity);
}
Expand All @@ -83,8 +96,10 @@ public function setEntityMaxDepth()
$entity->setMaxDepth(4);
$this->entityManager->persist($entity);
}
}
}
}//end foreach

}//end setEntityMaxDepth()


/**
* This function installs the huwelijksplanner bundle assets.
Expand All @@ -98,5 +113,8 @@ public function checkDataConsistency(): void
$this->setEntityMaxDepth();

$this->entityManager->flush();
}
}

}//end checkDataConsistency()


}//end class

0 comments on commit 69d9068

Please sign in to comment.