-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RELEASE] Version 12.5.3 with some small fixes
Releases: https://projekte.in2code.de/issues/65331 Releases: https://projekte.in2code.de/issues/65670 Releases: https://projekte.in2code.de/issues/65827 Releases: https://projekte.in2code.de/issues/65524
- Loading branch information
Showing
31 changed files
with
806 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace In2code\In2publishCore\Component\Core\Demand\Type; | ||
|
||
use In2code\In2publishCore\Component\Core\Record\Model\Node; | ||
|
||
class MmDemand implements Demand | ||
{ | ||
use UniqueRecordKeyGenerator; | ||
|
||
protected string $from; | ||
protected string $property; | ||
/** @var mixed */ | ||
protected $value; | ||
protected Node $record; | ||
|
||
/** | ||
* @param mixed $value | ||
*/ | ||
public function __construct(string $from, string $property, $value, Node $record) | ||
{ | ||
$this->from = $from; | ||
$this->property = $property; | ||
$this->value = $value; | ||
$this->record = $record; | ||
} | ||
|
||
public function addToDemandsArray(array &$demands): void | ||
{ | ||
$uniqueRecordKey = $this->createUniqueRecordKey($this->record); | ||
$demands[$this->from][$this->property][$this->value][$uniqueRecordKey] = $this->record; | ||
} | ||
|
||
public function addToMetaArray(array &$meta, array $frame): void | ||
{ | ||
$meta[$this->from][$this->property][] = $frame; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
Classes/Component/Core/DemandResolver/Mm/MmDemandResolver.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
namespace In2code\In2publishCore\Component\Core\DemandResolver\Mm; | ||
|
||
use Doctrine\DBAL\Exception; | ||
use In2code\In2publishCore\Component\Core\Demand\CallerAwareDemandsCollection; | ||
use In2code\In2publishCore\Component\Core\Demand\Demands; | ||
use In2code\In2publishCore\Component\Core\Demand\Type\MmDemand; | ||
use In2code\In2publishCore\Component\Core\DemandResolver\DemandResolver; | ||
use In2code\In2publishCore\Component\Core\DemandResolver\Exception\InvalidDemandException; | ||
use In2code\In2publishCore\Component\Core\Record\Factory\RecordFactoryInjection; | ||
use In2code\In2publishCore\Component\Core\RecordCollection; | ||
use In2code\In2publishCore\Component\Core\RecordIndexInjection; | ||
use In2code\In2publishCore\Component\Core\Repository\DualDatabaseRepositoryInjection; | ||
use In2code\In2publishCore\Component\Core\Repository\ForeignSingleDatabaseRepositoryInjection; | ||
use In2code\In2publishCore\Component\Core\Repository\LocalSingleDatabaseRepositoryInjection; | ||
|
||
class MmDemandResolver implements DemandResolver | ||
{ | ||
use RecordFactoryInjection; | ||
use RecordIndexInjection; | ||
use DualDatabaseRepositoryInjection; | ||
use LocalSingleDatabaseRepositoryInjection; | ||
use ForeignSingleDatabaseRepositoryInjection; | ||
|
||
public function resolveDemand(Demands $demands, RecordCollection $recordCollection): void | ||
{ | ||
foreach ($demands->getDemandsByType(MmDemand::class) as $mmTable => $fields) { | ||
foreach ($fields as $field => $valueMaps) { | ||
try { | ||
$rows = $this->dualDatabaseRepository->findMmByProperty( | ||
$mmTable, | ||
$field, | ||
array_keys($valueMaps) | ||
); | ||
} catch (Exception $exception) { | ||
if ($demands instanceof CallerAwareDemandsCollection) { | ||
$callers = $demands->getMeta(MmDemand::class, $mmTable, $field); | ||
$exception = new InvalidDemandException($callers, $exception); | ||
} | ||
throw $exception; | ||
} | ||
foreach ($rows as $mmId => $recordInfo) { | ||
$mmRecord = $this->recordIndex->getRecord($mmTable, $mmId); | ||
if (null === $mmRecord) { | ||
$mmRecord = $this->recordFactory->createMmRecord( | ||
$mmTable, | ||
$mmId, | ||
$recordInfo['local'] ?? [], | ||
$recordInfo['foreign'] ?? [], | ||
); | ||
if (null === $mmRecord) { | ||
continue; | ||
} | ||
} | ||
$mapValue = $mmRecord->getProp($field); | ||
foreach ($valueMaps[$mapValue] as $parent) { | ||
$parent->addChild($mmRecord); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.