Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-optional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,5 @@ jobs:
- run: php bin/console doctrine:migrations:migrate --no-interaction -e test
working-directory: api

- run: php bin/console doctrine:schema:validate -v -e test
- run: php bin/console doctrine:schema:validate --skip-sync -e test && php bin/console doctrine:migrations:up-to-date -e test && ! php bin/console doctrine:migrations:diff -e test --namespace DoctrineMigrations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- run: php bin/console doctrine:schema:validate --skip-sync -e test && php bin/console doctrine:migrations:up-to-date -e test && ! php bin/console doctrine:migrations:diff -e test --namespace DoctrineMigrations
- run: php bin/console doctrine:schema:validate --skip-sync -e test && php bin/console doctrine:migrations:up-to-date -e test && ! php bin/console doctrine:migrations:diff -e test --namespace DoctrineMigrations --silent --allow-empty-migrations

has the non zero exit code but does not show the error banner

working-directory: api
6 changes: 3 additions & 3 deletions api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"cweagans/composer-patches": "1.7.3",
"doctrine/doctrine-bundle": "2.13.1",
"doctrine/doctrine-migrations-bundle": "3.3.1",
"doctrine/orm": "2.20.0",
"doctrine/orm": "3.2.0",
"exercise/htmlpurifier-bundle": "5.0",
"friendsofsymfony/http-cache": "3.1.0",
"friendsofsymfony/http-cache-bundle": "3.0.2",
Expand Down Expand Up @@ -53,7 +53,7 @@
"require-dev": {
"brianium/paratest": "v7.6.0",
"friendsofphp/php-cs-fixer": "3.65.0",
"hautelook/alice-bundle": "2.13.0",
"hautelook/alice-bundle": "2.14.0",
"justinrainbow/json-schema": "6.0.0",
"php-coveralls/php-coveralls": "2.7.0",
"phpspec/prophecy-phpunit": "2.3.0",
Expand Down Expand Up @@ -161,4 +161,4 @@
}
}
}
}
}
123 changes: 52 additions & 71 deletions api/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 10 additions & 13 deletions api/src/HttpCache/PurgeHttpCacheListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
use Doctrine\ORM\Event\OnFlushEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Mapping\AssociationMapping;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\PersistentCollection;
use FOS\HttpCacheBundle\CacheManager;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
Expand All @@ -53,7 +53,7 @@ public function __construct(private readonly IriConverterInterface|LegacyIriConv
*/
public function preUpdate(PreUpdateEventArgs $eventArgs): void {
$changeSet = $eventArgs->getEntityChangeSet();
$objectManager = method_exists($eventArgs, 'getObjectManager') ? $eventArgs->getObjectManager() : $eventArgs->getEntityManager();
$objectManager = $eventArgs->getObjectManager();
$associationMappings = $objectManager->getClassMetadata(ClassUtils::getClass($eventArgs->getObject()))->getAssociationMappings();

foreach ($changeSet as $key => $value) {
Expand All @@ -76,7 +76,12 @@ public function preUpdate(PreUpdateEventArgs $eventArgs): void {
*/
public function onFlush(OnFlushEventArgs $eventArgs): void {
/** @var EntityManagerInterface */
$em = method_exists($eventArgs, 'getObjectManager') ? $eventArgs->getObjectManager() : $eventArgs->getEntityManager();
$em = $eventArgs->getObjectManager();

if (!$em instanceof EntityManagerInterface) {
return;
}

$uow = $em->getUnitOfWork();

foreach ($uow->getScheduledEntityInsertions() as $entity) {
Expand Down Expand Up @@ -118,7 +123,7 @@ public function postFlush(): void {
private function addTagsForManyToManyRelations($collection, $entities) {
$associationMapping = $collection->getMapping();

if (ClassMetadataInfo::MANY_TO_MANY !== $associationMapping['type']) {
if (ClassMetadata::MANY_TO_MANY !== $associationMapping['type']) {
return;
}

Expand Down Expand Up @@ -222,15 +227,7 @@ private function gatherRelationTags(EntityManagerInterface $em, object $entity):
$associationMappings = $em->getClassMetadata(ClassUtils::getClass($entity))->getAssociationMappings();

foreach ($associationMappings as $property => $associationMapping) {
// @phpstan-ignore-next-line
if (class_exists(AssociationMapping::class) && $associationMapping instanceof AssociationMapping && ($associationMapping->targetEntity ?? null) && !$this->resourceClassResolver->isResourceClass($associationMapping->targetEntity)) {
return;
}

// @phpstan-ignore-next-line
if (\is_array($associationMapping)
&& \array_key_exists('targetEntity', $associationMapping)
&& !$this->resourceClassResolver->isResourceClass($associationMapping['targetEntity'])) {
if ($associationMapping instanceof AssociationMapping && ($associationMapping->targetEntity ?? null) && !$this->resourceClassResolver->isResourceClass($associationMapping->targetEntity)) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions api/src/Repository/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ public function upgradePassword(PasswordAuthenticatedUserInterface $user, string
}

$user->password = $newHashedPassword;
$this->_em->persist($user);
$this->_em->flush();
$this->getEntityManager()->persist($user);
$this->getEntityManager()->flush();
}

/**
* @throws NonUniqueResultException
* @throws NoResultException
*/
public function loadUserByIdentifier(string $identifier): ?User {
$queryBuilder = $this->_em->createQueryBuilder();
$queryBuilder = $this->getEntityManager()->createQueryBuilder();
$queryBuilder->select('user');
$queryBuilder->from(User::class, 'user');
$queryBuilder->join('user.profile', 'profile');
Expand Down
Loading
Loading