Cannot find YML metadata when using a trailing slash for namespace
Opened this issue · 4 comments
I was pointing the serializer to the metadata by calling this:
$serializerBuilder->addMetadataDir($metadataDir, "Ns1\\Ns2\\");
Which causes the serializer to cut off the first letter of the class name:
/path/to/project/src/Ns1/Ns2/Metadata/roduct.yml
...while it should be...
/path/to/project/src/Ns1/Ns2/Metadata/Product.yml
It does this in lines 32-33 of Metadata\Driver\FileLocator
Workaround: call addMetadataDir
without a trailing namespace slash.
which operating system are you using?
Ubuntu 15.10
But I doubt that's the issue. The following lines cut off the $prefix
, it doesn't take the trailing slash into account:
$len = '' === $prefix ? 0 : strlen($prefix) + 1;
// the $len is then used for substr() on the following line:
$path = $dir.'/'.str_replace('\\', '.', substr($class->name, $len)).'.'.$extension;
I'm sorry if it took so long to answer your question. Is the bug still there? Feel free to send a PR, i will be glad to merge it.
I'll take a look at it soon ;)
On Sat, Jan 16, 2016, 11:47 Asmir Mustafic notifications@github.com wrote:
I'm sorry if it took so long to answer your question. Is the bug still
there? Feel free to send a PR, i will be glad to merge it.—
Reply to this email directly or view it on GitHub
#97 (comment).