Commit a2ddd8dc authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'master' into bg-php8

parents 755e2052 a56fd629
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
Changelog
=========

5.2.2
-----
- [FIX] Synchro : la colonne 'source_id' peut être présente dans la table/vue source.
- [FIX] Correction du type de retour trop restrictif de SourceListener::fetchDefaultSource().

5.2.1
-----
- [FIX] Dysfonctionnement total de la synchro avec table intermédiaire lorsque le 'code' de la source est spécifié dans la config
+12 −2
Original line number Diff line number Diff line
@@ -342,6 +342,8 @@ EOT;
        $diffViewName = $this->generateDiffViewName($destinationTable);
        $now = $this->platform->getNowExpression();

        $sourceIdExistsInColumns = in_array('source_id', $columns) || in_array('SOURCE_ID', $columns);

        $useSequenceForId = true;
        if ($idColumnSequence === false) {
            // si false est spécifié comme nom de séquence pour la colonne 'id', le type de cette colonne devra être
@@ -358,11 +360,15 @@ EOT;

        // génération des noms de colonnes de la table destination pour l'INSERT.
        $destinationColumns = $columns;
        if (!$sourceIdExistsInColumns) {
            array_unshift($destinationColumns,
                'source_id',
            );
        }
        array_unshift($destinationColumns,
            $createdOnCol,
            $createdByCol,
            $sourceCodeColumn,
            'source_id',
        );
        if ($useSequenceForId) {
            array_unshift($destinationColumns,
@@ -374,11 +380,15 @@ EOT;
        $selectExpressions = array_map(function (string $columnName) {
            return Synchro::V_DIFF_SRC_COLUMN_PREFIX . strtoupper($columnName);
        }, $columns);
        if (!$sourceIdExistsInColumns) {
            array_unshift($destinationColumns,
                'source_id',
            );
        }
        array_unshift($selectExpressions,
            $now,
            $createdByValue !== null ? $createdByValue : 'NULL',
            $sourceCodeColumn,
            'source_id',
        );
        if ($useSequenceForId) {
            $idExpr = $this->generateSQLForSequenceNextVal($idColumnSequence);
+2 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Events;
use RuntimeException;
use UnicaenDbImport\Entity\Db\Interfaces\SourceAwareInterface;
use UnicaenDbImport\Entity\Db\Interfaces\SourceInterface;
use UnicaenDbImport\Entity\Db\Source;

/**
@@ -76,7 +77,7 @@ class SourceListener implements EventSubscriber
     * @param EntityManager $entityManager
     * @return Source
     */
    private function fetchDefaultSource(EntityManager $entityManager): Source
    private function fetchDefaultSource(EntityManager $entityManager): SourceInterface
    {
        if ($this->sourceEntityClass === null) {
            throw new RuntimeException("La classe d'entité Source n'a pas été spécifiée");