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..

In the dependency provider doc, it says > To create a new dependency provider, copy and adapt th

U04RMV59JP8
U04RMV59JP8 Posts: 23 πŸ§‘πŸ»β€πŸš€ - Cadet
edited March 2023 in Slack General

In the dependency provider doc, it says

To create a new dependency provider, copy and adapt the snippet. Just rename the const FACADE_FOO_BAR and fooBar() according to your requirements.

Am i correct to assume that in

return $container->getLocator()->fooBar()->facade();

fooBar() has no meaning other than symbolic and theoretically can be completely random sequence of characters ?

Comments

  • fsmeier
    fsmeier Senior Software Engineer & Senior Technical Trainer Sprykee Posts: 986 βš–οΈ - Guardians (admin)
    edited March 2023

    Hey, it has a meaning. It would look for the FooBarFacade inside …/Zed/FooBar/Business/FooBarFacade.php

  • fsmeier
    fsmeier Senior Software Engineer & Senior Technical Trainer Sprykee Posts: 986 βš–οΈ - Guardians (admin)

    so not β€œrandom” - but has a system

  • U04RMV59JP8
    U04RMV59JP8 Posts: 23 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hmm, okay, thanks. Lowercase/uppercase doesn't matter in this, right ? I'm looking at foobar()->facade(), while the facade in FooBar/Business/ is FooBarFacade

  • U04RMV59JP8
    U04RMV59JP8 Posts: 23 πŸ§‘πŸ»β€πŸš€ - Cadet
  • fsmeier
    fsmeier Senior Software Engineer & Senior Technical Trainer Sprykee Posts: 986 βš–οΈ - Guardians (admin)

    It should matter (not 100% sure right now). foobar()->facade() should imo look for Foobar module. but fooBar()->facade() should look for FooBar module.

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer
    edited March 2023

    Casing matters, but you should get an auto completion from your editor.
    If not run docker/sdk console dev:ide:generate-auto-completion

  • U04RMV59JP8
    U04RMV59JP8 Posts: 23 πŸ§‘πŸ»β€πŸš€ - Cadet

    The issue is i'm looking at this project, and it has a case where it's lowercase, there['s only one module with that name, but it's FooBar, not fooBar. Going to ask the coder unless there's some special case for why it works

  • fsmeier
    fsmeier Senior Software Engineer & Senior Technical Trainer Sprykee Posts: 986 βš–οΈ - Guardians (admin)

    return $container->getLocator()->fooBar()->facade();

    This will look for FooBar modules Facade.

    there can not be a module fooBar - this would be wrong. So ->*getLocator*()->*fooBar*() looks for the FooBar module.

  • U04RMV59JP8
    U04RMV59JP8 Posts: 23 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited March 2023

    Oh, i partially misunderstood your initial response then. Thanks a lot. So the upper/lowercase doesn't matter, but the naming itself matters because that's how it looks for the proper Zed module to take the facade from.
    And the coders simply followed up on the camelCase for the naming convention

  • fsmeier
    fsmeier Senior Software Engineer & Senior Technical Trainer Sprykee Posts: 986 βš–οΈ - Guardians (admin)
    edited March 2023

    I think we still dont understand each other πŸ˜„

    upper/lowercase does matter.

    β€’ Module names (so the folders and namespaces) are not allowed to start with a lower case letter.
    β—¦ Wrong: src/Pyz/Zed/myModule
    β—¦ Wrong: src/Pyz/Zed/my-module
    β—¦ Correct: src/Pyz/Zed/MyModule
    β—¦ would work as well but is ugly: src/Pyz/Zed/Mymodule
    For finding the facade through locator you could then use for:
    β€’ src/Pyz/Zed/MyModule/Business/MyModuleFacade.php --> ->getLocator()->myModule()->facade()
    β€’ src/Pyz/Zed/Mymodule/Business/MymoduleFacade.php --> ->getLocator()->mymodule()->facade()