EasyAdminBundle: Reflection exception: Property id does not exist in v3.1.8
Describe the bug
Reflection exception: Property id does not exist is thrown when attempting to show a list view of an entity mapped to a user super class where the id visibility is private.
(OPTIONAL) Additional context Related to #3802
in ...\vendor\easycorp\easyadmin-bundle\src\Dto\EntityDto.php (line 83)
if (null !== $this->primaryKeyValue) {
return $this->primaryKeyValue;
}
$r = ClassUtils::newReflectionObject($this->instance);
$primaryKeyProperty = $r->getProperty($this->primaryKeyName); // line 83
$primaryKeyProperty->setAccessible(true);
$primaryKeyValue = $primaryKeyProperty->getValue($this->instance);
return $this->primaryKeyValue = $primaryKeyValue;
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (3 by maintainers)
Commits related to this issue
- Use symfony PropertyAccess to get value of Entity Primary Key, fixes #3967 — committed to sarim/EasyAdminBundle by sarim 4 years ago
- Use symfony PropertyAccess to get value of Entity Primary Key, fixes #3967 — committed to sarim/EasyAdminBundle by sarim 4 years ago
- Use symfony PropertyAccess to get value of Entity Primary Key, fixes #3967 — committed to sarim/EasyAdminBundle by sarim 4 years ago
- bug #4037 fix: #3967 Use symfony PropertyAccess to get value of Entity Primary Key (sarim) This PR was merged into the 3.0.x-dev branch. Discussion ---------- fix: #3967 Use symfony PropertyAccess ... — committed to EasyCorp/EasyAdminBundle by javiereguiluz 4 years ago
I posted a comment 2 days ago, seems like it didn’t submit.
I came up with another better solution, that is to use symfony propertyAccessor.
not only this solves the inheritance issue, it also solves the need for reflection hack. PropertyAccess uses getter method for getting value, which is the indented way to do it.
I’ll make a PR.
Ho, Sorry ! It’s working now !
Oh, did you replace the whole function?
The snippet I provided was meant to replace only this part: