-
Notifications
You must be signed in to change notification settings - Fork 137
Closed
Labels
Description
Jane version(s) affected: ?
Description
With symfony/property-info
>= 5.1.6
I get a problem mapping arrays without PHPDoc.
The problem have been introduced by this PR on symfony/property-info
(this is the only commit merged between 5.1.5 & 5.1.6).
How to reproduce
I try to map a class A
to a class B
.
Class A
contains:
/**
* @ORM\Column(type="bigint[]")
*/
private array $property = [];
public function getProperty(): array
{
return $this->property;
}
Class B
contains:
public array $property = [];
I try to map them like this:
$a = new Class A();
$a->setProperty([1, 2, 3, 4]);
$b = $mapper->map($a, B::class);
var_dump($b->property); // [] <== empty array instead of [1, 2, 3, 4]
Possible Solution
This is not a solution but adding the annotation @var string[]
on both properties solves the problem.
Edit: Adding this annotation only on the output class works as well.
Additional context
TBH I don't even know if this problem is linked to the automapper or to the property info component. :/