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

Hi, I am trying to access a function in the MerchantRelationshipProductListRepository, but I get an

ULL0N440J
ULL0N440J Posts: 184 πŸ§‘πŸ»β€πŸš€ - Cadet

Hi, I am trying to access a function in the MerchantRelationshipProductListRepository, but I get an error upon calling.

No connection defined for database "zed". Did you forget to define a connection or is it wrong written?

I didn't change this class at all, so I'm a bit surprised that there's no stream already πŸ€” (Full stacktrace in Thread)

Comments

  • ULL0N440J
    ULL0N440J Posts: 184 πŸ§‘πŸ»β€πŸš€ - Cadet
    [2020-02-17 14:58:21] Yves.CRITICAL: Propel\Runtime\Exception\RuntimeException - No connection defined for database "zed". Did you forget to define a connection or is it wrong written? in "/data/shop/development/current/vendor/propel/propel/src/Propel/Runtime/ServiceContainer/StandardServiceContainer.php::279" {"exception":"[object] (Propel\\Runtime\\Exception\\RuntimeException(code: 0): No connection defined for database \"zed\". Did you forget to define a connection or is it wrong written? at /data/shop/development/current/vendor/propel/propel/src/Propel/Runtime/ServiceContainer/StandardServiceContainer.php:279)
    [stacktrace]
    #0 /data/shop/development/current/vendor/propel/propel/src/Propel/Runtime/ServiceContainer/StandardServiceContainer.php(372): Propel\\Runtime\\ServiceContainer\\StandardServiceContainer->getConnectionManager('zed')
    #1 /data/shop/development/current/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/ModelCriteria.php(992): Propel\\Runtime\\ServiceContainer\\StandardServiceContainer->getReadConnection('zed')
    #2 /data/shop/development/current/vendor/spryker/merchant-relationship-product-list/src/Spryker/Zed/MerchantRelationshipProductList/Persistence/MerchantRelationshipProductListRepository.php(64): Propel\\Runtime\\ActiveQuery\\ModelCriteria->find()
    #3 /data/shop/development/current/src/Pyz/Client/MerchantRelationship/MerchantRelationshipClient.php(33): Spryker\\Zed\\MerchantRelationshipProductList\\Persistence\\MerchantRelationshipProductListRepository->findProductListCollectionByIdMerchantRelationship(1)
    #4 /data/shop/development/current/src/Pyz/Client/ProductList/PListClient.php(53): Pyz\\Client\\MerchantRelationship\\MerchantRelationshipClient->findProductListCollectionByIdMerchantRelationship(Object(Generated\\Shared\\Transfer\\MerchantRelationshipTransfer))
    #5 /data/shop/development/current/src/Pyz/Client/ProductList/PListClient.php(40): Pyz\\Client\\ProductList\\PListClient->getProductListsForMerchantRelation(Object(Generated\\Shared\\Transfer\\MerchantRelationshipTransfer))
    #6 /data/shop/development/current/src/Pyz/Yves/CompanyPage/Controller/ProductListPageController.php(35): Pyz\\Client\\ProductList\\PListClient->getProductListCollectionByOwnerCompanyBusinessUnit(Object(Generated\\Shared\\Transfer\\CompanyBusinessUnitTransfer))
    #7 /data/shop/development/current/vendor/symfony/http-kernel/HttpKernel.php(151): Pyz\\Yves\\CompanyPage\\Controller\\ProductListPageController->indexAction(Object(Symfony\\Component\\HttpFoundation\\Request))
    #8 /data/shop/development/current/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)
    #9 /data/shop/development/current/vendor/spryker/application/src/Spryker/Shared/Application/Application.php(105): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))
    #10 /data/shop/development/current/vendor/spryker/application/src/Spryker/Shared/Application/Application.php(86): Spryker\\Shared\\Application\\Application->handle(Object(Symfony\\Component\\HttpFoundation\\Request))
    #11 /data/shop/development/current/public/Yves/index.php(22): Spryker\\Shared\\Application\\Application->run()
    #12 {main}
    "} {"environment":{"application":"YVES","environment":"development","store":"DE","locale":"de_DE"},"server":{"url":"[www.de.suite.local](http://www.de.suite.local/company/assortment>","is_https":false,"hostname":"<http://www.de.suite.local)","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36","user_ip":"10.10.0.1","request_method":"GET","referer":"<http://www.de.suite.local/company/business-unit>"},"request":{"requestId":"54e39ce4","type":"WEB","request_params":[]}}
    
  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    I had such issue once when one of my containers has crashed. Have you tried to re-start it (in case you’re using docker)?

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    I also saw that when I tried to run acceptance tests in a very specific manner on devtest environment, not sure it’s your case, however

  • Eugenia Poidenko
    Eugenia Poidenko Sprykee Posts: 145 πŸ§‘πŸ»β€πŸš€ - Cadet

    You are accessing Repository from Yves application. Yves should access Zed things through Client only.

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    Oh, that could be it, too πŸ‘

  • Eugenia Poidenko
    Eugenia Poidenko Sprykee Posts: 145 πŸ§‘πŸ»β€πŸš€ - Cadet

    and client do rpc call to zed (through gateway controller).

  • ULL0N440J
    ULL0N440J Posts: 184 πŸ§‘πŸ»β€πŸš€ - Cadet

    I am actually doing this πŸ€”

    PageController calls the ProductListClient. I resolve a MerchantRelation and call

    return $this->getFactory()createMerchantRelationshipClient()->findProductListCollectionByIdMerchantRelationship($merchantRelation);
    

    The findProductListCollectionByIdMerchantRelationship() itself comes from Client.. am I missing something?

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    @ULL0N440J, according to your stacktrace:

    /data/shop/development/current/src/Pyz/Client/MerchantRelationship/MerchantRelationshipClient.php(33): Spryker\\Zed\\MerchantRelationshipProductList\\Persistence\\MerchantRelationshipProductListRepository->findProductListCollectionByIdMerchantRelationship(1)
    
  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    which means you’re trying to run query from the Client

  • ULL0N440J
    ULL0N440J Posts: 184 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ah.. alright, got it. Will put this code compeltely into GatewayController

  • ULL0N440J
    ULL0N440J Posts: 184 πŸ§‘πŸ»β€πŸš€ - Cadet

    Thanks πŸ™‚

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    This should be the flow on Zed:
    Gateway Controller (communication) => Facade (Business) => Some model (Business) -> Query (Persistence)

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited February 2020

    there are other possible options, but try to avoid doing queries in the GatewayController πŸ‘