dflydev / dflydev-psr0-resource-locator-composer

Composer PSR-0 Resource Locator
MIT License
3 stars 1 forks source link

Using fallback directory #1

Open dirkluijk opened 10 years ago

dirkluijk commented 10 years ago

Hi,

It seems that the ComposerResourceLocator is not able to load resources from Composers fallback directory.

My composer.json:

{
    "autoload": {
        "psr-0": {
            "": "src"
        }
}

My class is in /src/Serius/Core/Page/Entity/Page.php, my mapping file in /src/Serius/Core/Page/Resources/mapping/Serius.Core.Page.Entity.Page.dcm.yml.

My configuration:

$mappings = array(
                        array(
                            "type" => "yml",
                            "namespace" => 'Serius\Core\Page\Entity',
                            "resources_namespace" => 'Serius\Core\Page\Resources\mappings',
                            'alias' => 'Serius'
                        )
                    );

After debugging, I found that ComposerResourceLocator is only using the Composer prefixes, not the fallback directory.

Is this just not supported, or am I doing something wrong?

simensen commented 10 years ago

It just isn't supported yet. If you want to add the support (provided Composer has a way to get the fallback directories!) I'd be happy to merge it. I don't have a lot of time to try to add this myself currently.

Are you actively using PSR-0 resource locator with Doctrine ORM? Are you liking it? I was never sure anyone else ever bothered to try it. :) I'd love to talk to you more about your experiences with it!

dirkluijk commented 10 years ago

Yeah, long story. ;)

I want to use Doctrine ORM in a Silex application, and your DoctrineOrmServiceProvider seems the best solution at the moment. For this project I prefer YAML mapping over annotations, and I like the 'namespaceish' configuration.

Already working on a pull request. Thank you for supporting!

simensen commented 10 years ago

Nice. :)

Well, I took the PSR-0 resource locator stuff out of the 2.x version of the Doctrine ORM Service Provider but I intend to find a replacement for that kind of functionality soon. I don't have any stable releases for it yet.

If I know someone is actually actively using the namespaceish configuration stuff it will put a higher priority on replacing that functionality sooner rather than later. :)

Thanks for your feedback!