Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration of ImportDefinition is returned when getting ExportDefinition by ID #424

Closed
paulverdu opened this issue Oct 28, 2024 · 10 comments

Comments

@paulverdu
Copy link
Contributor

paulverdu commented Oct 28, 2024

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Branch? 5.1.1

I'm currently working on upgrading a project to Pimcore 11 and i'm facing an issue where Import and ExportDefinitions are not correctly returned.

When running the list command for exports and import i'm correctly seeing all the exports and imports and their corresponding id's, but when running my Functional tests and getting exports by name, it's not find them.
When getting the exports by id, I do get an instance of ExportDefinition but with all the configurations, including mapping of the import definition with the corresponding id. I've ran the convert php to yaml commands and made sure they all have an id again.

I have an ExportDefinition with id 7 called 'Tech Mapping' and an ImportDefinition with id 7 called 'Washing Instruction'.
When finding export with name, I get the exception "Export Definition with Name "Tech Mapping" does not exist.".
When find export with id 7, I get an ExportDefinition with all the data from the ImportDefinition 'Washing Instructions'.

I've never had this problem. Am I missing something?

@dpfaffenbauer
Copy link
Collaborator

How do you use the getByName functions? Can you give me some examples?

@paulverdu
Copy link
Contributor Author

paulverdu commented Oct 28, 2024

Hi @dpfaffenbauer. Thanks for the super fast response!

I'm either using:

\Instride\Bundle\DataDefinitionsBundle\Model\ExportDefinition::getByName('Tech Mapping');

But also importing data_definitions.repository.export_definition as a service in my classes like:

    App\ProductPriceBundle\MessageHandler\ExportB2bPricesHandler:
        arguments:
            - '@data_definitions.repository.export_definition'
            - '@Instride\Bundle\DataDefinitionsBundle\Exporter\ExporterInterface'

And then using $this->repository->getByName('Tech Mapping');

@paulverdu
Copy link
Contributor Author

In my Functional Codeception tests i'm using:

/** @var DefinitionRepository $exportRepository */
$exportRepository = $this->grabService('data_definitions.repository.export_definition');

@dpfaffenbauer
Copy link
Collaborator

Ok, that will help, I'll give a test sometime this week?

@paulverdu
Copy link
Contributor Author

Thanks. I will see if I can find the problem in the bundle my self in the meantime. I think there is something weird going on somewhere. ImportDefinitions work correctly

@paulverdu
Copy link
Contributor Author

Scherm­afbeelding 2024-10-28 om 09 13 54

The repository and the dao looks fine.

@paulverdu
Copy link
Contributor Author

Hi @dpfaffenbauer

It seems the caching mechanism in vendor/pimcore/pimcore/lib/Model/Dao/PimcoreLocationAwareConfigDao.php is not correctly working with the bundle. self::cache returns all the ImportDefinitions instead of the ExportDefinitions.

So self::$cache[$this->settingsStoreScope][$id] returns the ExportDefinitions.
I can see $this->settingsStoreScope is returning data_definitions, but should this be data_definitions.export and data_definitions.import? To differentiate Exports and Imports?

@dpfaffenbauer
Copy link
Collaborator

@paulverdu was just checking too, yes, you are right. Do want to make a PR to change that?

@paulverdu
Copy link
Contributor Author

Just changed the code to add the config key from each individual Dao to the settingsStoreScope value. Testing it now and will create a PR 👍

@paulverdu
Copy link
Contributor Author

Closed since it's fixed with #427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants