Calling Developers!
We are reenergizing our code contribution process! Learn More

What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Where do I register the new HelloWorldControllerProvider ? From what I can barely make out in the v

Options
U01JBB8LNTE
U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet

Where do I register the new HelloWorldControllerProvider ? From what I can barely make out in the video it looks like it's being registered in ShopApplication/YvesBootstrap.php

Comments

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    Intuition would suggest this is incorrect, and when tried it results in an error

    TypeError - Argument 1 passed to Silex\Application::register() must implement interface Silex\ServiceProviderInterface, instance of Pyz\Yves\HelloWorld\Plugin\Provider\HelloWorldControllerProvider given, called in /data/src/Pyz/Yves/ShopApplication/YvesBootstrap.php on line 24
    
  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    Then where is the router stack? the actual written documentation contradicts what Hussam outlines on https://training.spryker.com/courses/take/developer-bootcamp/texts/4326883-hello-world-lesson-and-challenge suggest that you should add the controller to Spryker\Yves\RouterExtension\Dependency\Plugin\RouteProviderPluginInterface[]

    looks like that is in Yves/Router/RouterDependencyProvider but the code is very much different and includes a different naming scheme, which of these is correct the written docs or the video?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    okee the docs seemed to work better, but the original boilerplate had a registered route in it

    <?php
    
    namespace Pyz\Yves\HelloWorld\Plugin\Provider;
    
    use SprykerShop\Yves\ShopApplication\Plugin\Provider\AbstractYvesControllerProvider;
    use Silex\Application;
    
    class HelloWorldControllerProvider extends AbstractYvesControllerProvider
    {
    
        const HELLOWORLD_INDEX = 'helloworld-index';
    
        /**
         * @param \Silex\Application $app
         *
         * @return void
         */
        protected function defineControllers(Application $app)
        {
            $this->createGetController('/hello-world', static::HELLOWORLD_INDEX, 'HelloWorld', 'Index', 'index');
        }
    
    }
    

    does it not need to be added to the registry?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    The error was a type error so maybe I need to pass it the instance of the application?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    ok so the challenge and and the video seem on some level mutually exclusive? I don't actually see the code that is being referenced in the video and since the challenge code sets up the route and references the controller, there isn't any need to register the controller directly.

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    Let me know If I'm off base on this.

  • Hi! I assume you are asleep. I will give an extensive answer in about an hour, so you will have it when you are up

  • so. there was an outdated part in the bootcamp

  • i am currently in the process of replacing it with recently tested versions. should be done soon

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    ye, this is true 😄

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    no worry, thanks for jumping into it

  • if you check it again you should see the new version of that particular bit

  • i am also updating the rest of the bootcamp, so please let me know if something might have slipped! happy coding! 👍

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    expected?

  • the change in design?

  • then yes

  • Unknown
    edited January 2021
    Options

    or did i miss anything?

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    Oh don't know yet i'll keep cruisin' though cheers

  • U01JBB8LNTE
    U01JBB8LNTE Posts: 207 🧑🏻‍🚀 - Cadet
    Options

    Hey @UJN2JRU4F ur probably sleeping now or out having a beer (if you are into that kinda thing), I found a few errors, nitpicky stuff, but i mentioned it in the discussion for #6 Architecture Walkthrough.

    Also a few discrepancies between the generated code and the documented directions.

    Hope it helps. ☮ Thanks for the docs update. Much appreciated 🙏

  • beer? me? never! 😊 🍻

  • i’ll look into the comments right away