UrlShortenerBundle icon indicating copy to clipboard operation
UrlShortenerBundle copied to clipboard

Undefined index: provider

Open drnikko opened this issue 13 years ago • 5 comments

On a clean install [ErrorException]
Notice: Undefined index: provider in /website/vendor/bundles/Sly/UrlShortenerBundle/Config/Config.php line 76

I'm new to Symfony, so this could be due to another issue with my config, but the rest of the app is working fine. If I fix, I'll certainly submit a patch.

drnikko avatar Aug 09 '12 19:08 drnikko

Hi!

Have you created a sly_url_shortener entry in your app/config/config.yml file? https://github.com/Ph3nol/UrlShortenerBundle/blob/master/Resources/doc/usage.markdown#1-configuration-bundle-informations

Your entity seems not to have a defined provider. Can you copy your config.yml file?

Ph3nol avatar Aug 09 '12 19:08 Ph3nol

Ah, you were right about that. I should have moved into the usage section.

The issue now (and I can open another if you'd like) is Call to a member function getPattern() on a non-object in /website/vendor/bundles/Sly/UrlShortenerBundle/Router/Router.php on line 45

The code in question from my default controller:

    $atweet = new Tweet();
    $atweet->__set('text', "i am the text");
    $atweet->__set('author', "nikki");

   $urlShortener = $this->container->get('sly_url_shortener');
   $newname = $urlShortener->getShortUrl($atweet);

You can also tell me to f off and figure it out myself. I work in open source, I know you're doing this for free. :)

drnikko avatar Aug 09 '12 20:08 drnikko

No problem about helping you! :)

Please, can you past the sly_url_shortener code part you are using into you config.yml file?

Ph3nol avatar Aug 09 '12 20:08 Ph3nol

I think the problem is you have no route given to your entity declaration.

A route linked to an entity (with giving an ID, a slug or other) has to be given for URL generation.

Example: My entity Content, which ID is 1, uses the route content_show to generate the final shortened URL. So I have to give content_show as route parameter to make the magic happen! ;)

I don't know if I'm clear, but you can take a look at the base config to discover it: https://github.com/Ph3nol/UrlShortenerBundle/blob/master/Resources/doc/usage.markdown#1-configuration-bundle-informations

(sorry for my poor english...)

Ph3nol avatar Aug 09 '12 20:08 Ph3nol

You can take a look at the bundle Router class for more informations about the URL construction from the objet/route duo: https://github.com/Ph3nol/UrlShortenerBundle/blob/master/Router/Router.php

Ph3nol avatar Aug 09 '12 21:08 Ph3nol