You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 17, 2025. It is now read-only.
Currently the MetadataMap always does an exact class name comparison between get_class($your_resource) and the key in the map. It doesn't take inheritance into account. This prevents the map being used with Doctrine entities.
If you retrieve a MyModels\User instance from doctrine, get_class() might actually return DoctrineORMModule\Proxy\__CG__\MyModels\User, which is an auto-generated proxy subclass.
Could I suggest that PhlyRestfully either
Make MetadataMap check each map key against the resource with an instanceof test when the get_class comparison fails, or
Make it easier to supply a custom subclass of MetadataMap so that Doctrine users can implement this behaviour?
At the moment i'm making do by awkwardly overriding the definition of the 'PhlyRestfully\MetadataMap' service factory in my local module, to instantiate my MetadataMap subclass.
Here's the code I have in my subclass FYI:
publicfunctionget($class)
{
//First try the default logic (look for an exact class-name match)if (parent::has($class))
returnparent::get($class);
//Next check each class in the map to see if our object inherits from itif (is_object($class))
{
foreach ($this->mapas$className => $metadata)
{
if ($classinstanceof$className)
return$metadata;
}
}
returnnull;
}