Skip to content
This repository has been archived by the owner on Nov 30, 2017. It is now read-only.

Cannot load resource "alias: app.book #393

Open
abhinavkumar940 opened this issue Jan 8, 2016 · 8 comments
Open

Cannot load resource "alias: app.book #393

abhinavkumar940 opened this issue Jan 8, 2016 · 8 comments
Labels

Comments

@abhinavkumar940
Copy link

I am on Symfony v2.8.0

app/AppKernel.php

new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),

app/config/config.yml

sylius_resource:
    resources:
        app.book:
            classes:
                model: AppBundle\Entity\Book

app/config/routing.yml

app_book:
    resource: |
        alias: app.book
    type: sylius.resource_api

And then when I do
./bin/console debug:router

I get

[Symfony\Component\Config\Exception\FileLoaderLoadException]  
Cannot load resource "alias: app.book                         
".       

Please note that the exception is a FileLoaderLoadException I'd assume that it hasn't even reached Sylus yet.

Would love to provide a PR if somebody gives me a direction.

@michalmarcinkowski
Copy link
Contributor

You have to provide alias in the routing config.

app_book:
    resource: |
        alias: app.book
    type: sylius.resource

@abhinavkumar940
Copy link
Author

Thank you for your prompt response @michalmarcinkowski
That must have lost during the copy/paste transition but I can confirm that I have alias in my code, and the error is still there

@pjedrzejewski
Copy link
Member

@abhinavkumar940 Thanks for report, I will try to reproduce the problem and get back to you.

@pjedrzejewski
Copy link
Member

Hello @abhinavkumar940, I just tried the docs with clean Symfony 2.8 and everything seems to work - https://github.com/pjedrzejewski/SRB-Example. Have a look if you have any differences. Anyway, I discovered another small issue with the documentation, so it's a plus. :) Let me know if you figure it out. I will leave this open until you give us feedback, thanks!

@abhinavkumar940
Copy link
Author

Hi @pjedrzejewski many thanks for your reply. Here are my findings.

Your test repo works, but it's using dev-master and not one of the tagged releases. I just created a blank 2.8 project which uses 0.15 it replicates the issue. https://github.com/abhinavkumar940/SRB-Example-Stable

@michalmarcinkowski
Copy link
Contributor

@abhinavkumar940 the docs are up to date with current master. The 0.15 release doesn't have this configuration options. Add to your dependencies "sylius/resource-bundle": "0.16.*@dev" or wait for 0.16.0 version (should be released tomorrow).

@abhinavkumar940
Copy link
Author

That's still kind of an issue, right? I mean I am sure to encounter that even if I follow the docs.

Anyways, I've got to lower my minimum-stability setting in composer to get that working. If you find it's okay, I will close this.

Let me know, thanks.

@gabiudrescu
Copy link
Contributor

somehow, I ended up here searching for the error @abhinavkumar940 had initially to figure out the planets would not align very well for those who use this bundle for the first time - especially on Ubuntu 14.04.

if you use symfony installer like this:
symfony new test 2.8

the symfony instance will have the following composer.json:


    "config": {
        "bin-dir": "bin",
        "platform": {
            "php": "5.3.9"
        }
    },

and using composer require sylius/resource-bundle ^0.16 you'll get an error on Ubuntu 14.04 claiming 5.5.9-1ubuntu4.14 != 5.5.9 and there are missing dependencies from this bundle.

that's how I ended up using 0.15 and bumped into this error. maybe there should be a mention in the doc for using 0.16 or above as there are BC.

happy to do a small PR on that if I get the green light :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants