Skip to content

Import Entity Resolver

MarcoGuiducci edited this page Nov 20, 2018 · 6 revisions

As we can see in Documentation, in CSV Import we can use different kinds of resolver strategies in order to determine if an object already exists and must bu updated or if is a new one.

In addition to the standard methods, Pimcore offer the possibility to define a custom PHP resolver. In order to implement a custom resolver, just create a PHP class that extends the Pimcore AbstractResolver class. In the CSV Import interface select "Code" as Resolver Type and pass your custom resolver class path.

Let's see an example skeleton:

class MyResolver extends AbstractResolver{

    public function resolve(\stdClass $config, int $parentId, array $rowData){
        //Implementation here        
    }
}

N.B In object creation you MUST set the "key" field value. Key is used to define object Path and is the visible name of the object in the Pimcore interface. Not defining key in import resolver will lead to an error.