jgrygierek / BatchEntityImportBundle

Importing entities with preview and edit features for Symfony.
MIT License
9 stars 6 forks source link

[ORM] Possibility to make it works with doctrine/orm 3.2.x #96

Closed rrr63 closed 1 month ago

rrr63 commented 1 month ago

Hello,

First, thanks for your bundle,

It is plan to make upgrade orm dependency to 3.2 ?

jgrygierek commented 1 month ago

Hi, I can try to add it.

jgrygierek commented 1 month ago

@rrr63 Hi, check the newest version

rrr63 commented 1 month ago

Perfect thanks ! Also, i am testing your bundle, can we import an array property ? I can't figure it out on the doc, i made a quick fix in local to test

jgrygierek commented 1 month ago

Hmm, I think it is not currently possible, only scalar values are allowed.

The question is, how this array should look like in files?

rrr63 commented 1 month ago

Maybe we could add a default separator for array, and possibility to overide it ?

if (method_exists($entity, $setterName)) {
    $reflection = new \ReflectionMethod($entity, $setterName);
    $params = $reflection->getParameters();

    if (!empty($params)) {
        $paramType = $params[0]->getType();
        if ($paramType && $paramType->getName() === 'array') {
            $value = explode('//', $value);
        }
    }
    $entity->$setterName($value);
} else {
    $entity->$propertyName = $value;
}
jgrygierek commented 1 month ago

Can you create separated issue for this?

rrr63 commented 1 month ago

Sure