kaliop-uk / ezmigrationbundle

This bundle makes it easy to handle eZPlatform / eZPublish5 content upgrades/migrations
GNU General Public License v2.0
53 stars 81 forks source link

Cannot match location by group #210

Closed korsarNek closed 5 years ago

korsarNek commented 5 years ago

kaliop/ezmigrationbundle: 5.9.3

Writing a migration for locations with a group match condition throws an error:

Example migration:

-
    type: location
    mode: update
    match:
        group: 13 # Editors
    parent_location: 'reference:editor_group_germany_id'

stacktrace (paths shortened):

PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function matchOneByKey() on null in ./vendor/kaliop/ezmigrationbundle/Core/Matcher/QueryBasedMatcher.php:153
Stack trace:
#0 ./vendor/kaliop/ezmigrationbundle/Core/Matcher/LocationMatcher.php(150): Kaliop\eZMigrationBundle\Core\Matcher\QueryBasedMatcher->getQueryCriterion('group', Array)
#1 ./vendor/kaliop/ezmigrationbundle/Core/Matcher/LocationMatcher.php(91): Kaliop\eZMigrationBundle\Core\Matcher\LocationMatcher->getQueryCriterion('group', Array)
#2 ./vendor/kaliop/ezmigrationbundle/Core/Matcher/LocationMatcherDirectLoad.php(44): Kaliop\eZMigrationBundle\Core\Matcher\LocationMatcher->matchLocation(Array, Array, 0, 0)
#3 ./vendor/kaliop/ezmigrationbundle/Core/Matcher/LocationMatcher.php(47): Kaliop\eZMigrationBundle\Core\Matcher\LocationMatcherDirectLoad->matchLocation(Array,  in ./vendor/kaliop/ezmigrationbundle/Core/Matcher/QueryBasedMatcher.php on line 153

The groupMatcher field of the QueryBasedMatcher doesn't seem to be set.

gggeek commented 5 years ago

Indeed, there seems to be mistake in the constructor of QueryBasedMatcher. Could you try replacing line 92 with $this->groupMatcher = $groupMatcher; ?

korsarNek commented 5 years ago

@gggeek you already closed this ticket? Should I try it out?

gggeek commented 5 years ago

Sorry, I was too quick for my own good (either that, or github was too sentient for me...). You are welcome to test, yes

korsarNek commented 5 years ago

PR https://github.com/kaliop-uk/ezmigrationbundle/pull/212