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, Can anyone please suggest what might be the reason to receive below error.
Hi, Can anyone please suggest what might be the reason to receive below error.
Comments
-
could you show us the code around the reported line of failure?
0 -
which PHP version are you using?
And can you share the code snipped form this error instead of the screenshot?0 -
Why did you create a Pyz business class that is called βTransferβ? Transfer objects do not have an extension mechanism, you factory is extending a Sprkyer factory that has a PHP typehint there. Those interfaces between your extended factory and the base Spryker factory do not match
0 -
You can just use the Generated\DataImportConfigurationTransfer in your function and it will all be fine
0 -
/** * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface|\Spryker\Zed\DataImport\Business\Model\DataSet\DataSetStepBrokerAwareInterface */ protected function createDealerPortalCustomerImporter(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer) { $dataImporter = $this->getCsvDataImporterFromConfig( $this->getConfig()->buildImporterConfigurationByDataImportConfigAction($dataImportConfigurationActionTransfer) ); $dataSetStepBroker = $this->createTransactionAwareDataSetStepBroker(); $dataSetStepBroker ->addStep(new DealerPortalCustomerWriterStep()); $dataImporter->addDataSetStepBroker($dataSetStepBroker); return $dataImporter; } /** * @param \Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer * * @return \Spryker\Zed\DataImport\Business\Model\DataImporterInterface|null */ public function getDataImporterByType(DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): ?DataImporterInterface { switch ($dataImportConfigurationActionTransfer->getDataEntity()) { case DataImportConfig::IMPORT_TYPE_DPC; return $this->createDealerPortalCustomerImporter($dataImportConfigurationActionTransfer); default: return null; } }
0 -
You didn't import/use the transfer class
0 -
Itβs a PHP exception that is not relevant to the code really, itβs as I said, the function signature problem
0 -
The transfer class is not on the
use
block, that's why php is assuming it is on the same namespace as the factory0 -
have added use Generated\Shared\Transfer\DataImportConfigurationActionTransfer; to DataImportBusinessFactory.php
0 -
still same error
0 -
technically it should not be possible that the error is the same after the import was added
0 -
letβs dive into this.
0 -
can you show us where
createDealerPortalCustomerImporter()
is called?0 -
can you also copy paste the error as plain text here?
0 -
createDealerPortalCustomerImporter() is called on the top in DataImportBusinessFactory class
0 -
Here is the error: Fatal error: Declaration of Pyz\Zed\DataImport\Business\DataImportBusinessFactory::getDataImporterByType(Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): ?Pyz\Zed\DataImport\Business\DataImporterInterface must be compatible with Spryker\Zed\DataImport\Business\DataImportBusinessFactory::getDataImporterByType(Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): ?Spryker\Zed\DataImport\Business\Model\DataImporterInterface in /data/src/Pyz/Zed/DataImport/Business/DataImportBusinessFactory.php on line 82
ErrorException - Exception: FATAL ERROR - Declaration of Pyz\Zed\DataImport\Business\DataImportBusinessFactory::getDataImporterByType(Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): ?Pyz\Zed\DataImport\Business\DataImporterInterface must be compatible with Spryker\Zed\DataImport\Business\DataImportBusinessFactory::getDataImporterByType(Generated\Shared\Transfer\DataImportConfigurationActionTransfer $dataImportConfigurationActionTransfer): ?Spryker\Zed\DataImport\Business\Model\DataImporterInterface
in /data/src/Pyz/Zed/DataImport/Business/DataImportBusinessFactory.php (82)Command: /data/vendor/bin/console data:import:dealer-portal-customer
Trace:
0 /data/vendor/spryker/error-handler/src/Spryker/Shared/ErrorHandler/ErrorHandlerEnvironment.php(99): Spryker\Shared\ErrorHandler\ErrorHandler->handleFatal()
1 [internal function]: Spryker\Shared\ErrorHandler\ErrorHandlerEnvironment->Spryker\Shared\ErrorHandler{closure}()
0 -
are you using PHP 7.2 or 7.4?
0 -
7.4
0 -
it seems you are also missing the import of the
Spryker\Zed\DataImport\Business\Model\DataImporterInterface
0 -
I imported this too
0 -
Now showing data importer not found
0 -
is your
Pyz\Zed\DataImport\Business\DataImporterInterface
extendingSpryker\Zed\DataImport\Business\Model\DataImporterInterface
?0 -
Have imported Spryker\Zed\DataImport\Business\Model\DataImporterInterface in DataImportBusinessFactory
0 -
@UJN2JRU4F any inputs?
0 -
π DM
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random