currently I have this code on my admin class. Since getSubClasses going to become final, this code must change. But HOW? Docs are lacking.
I tried doing setSubClasses in the constructor, but I also need the user object to calculate the classes, and it is not set yet in the constructor...
Basically how do I go about modifying these final methods because there doesn't seem to be a straightforward replacement.
public function getSubClasses()
{
$subClasses = parent::getSubClasses();
// ...some code...
return $subClasses;
}
I found a solution, not sure if it's correct... Please reply if you know more about this solution.
I was trying to modify getDataSourceIterator() which on sonata 4 they made this method final.
AbstractAdmin.php on version 3
AbstractAdmin.php on version 4
My class is extending the AbstractAdmin and trying to modify the getDataSourceIterator() but with version 4 is not possible cause of the final.
My example:
and I changed to this
Basically I implement the AdminInterface AGAIN (because is already implemented from AbstractAdmin) and that gives me the freedom to modify the method.
As I said might be bad idea but solved my issue.