instride-ch / pimcore-data-definitions

Data Definitions Plugin for Pimcore
Other
76 stars 58 forks source link

Argument #1 ($id) must be of type string, int given #416

Open paulverdu opened 1 month ago

paulverdu commented 1 month ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? yes
Branch? 5.1

I keep getting the following error. Even when updating to the newest 5.1 tag.

 Instride\Bundle\DataDefinitionsBundle\Model\ImportDefinition\Dao::getById(): Argument #1 ($id) must be of type string, int given, called in /Users/paulverdu/Dev  
  elopment/emico/vivara/vendor/instride/data-definitions/src/DataDefinitionsBundle/Model/ImportDefinition/Dao.php on line 101 

I don't understand why the method getById still required a string for $id value when $id is clearly an integer. Am I missing something here or is it just really broken right now?

paulverdu commented 1 month ago

Also the method getDataByName from vendor/pimcore/pimcore/lib/Model/Dao/PimcoreLocationAwareConfigDao.php called within the getById method is requiring a string $id. Why is this method getting the id as string when the method is called getDataByName?

paulverdu commented 1 month ago

The command data-definitions:import clearly states that the parameter -d can be the ID or name, but when executing it with an id integer (2) the error Import Definition with Name "2" does not exist. is presented.

And when executing it with a name string (SuperGroupsAndGroups) the error Argument #1 ($id) must be of type string, int given is presented.

dpfaffenbauer commented 1 month ago

Please see the release notes for 5.1: https://github.com/instride-ch/pimcore-data-definitions/releases. We f**** something up in 5.0 which we fixed now. We know this is a BC break, but it is worth it.

paulverdu commented 1 month ago

Hi @dpfaffenbauer, i did these changes. I renamed my yaml files to 1.yaml, 2.yaml etc. Change the name in the definitions files to 1 and 2 and also added id: 1 and id: 2. But these errors still occur.

1.yaml:

data_definitions:
    import_definitions:
        1:
            id: 1
            name: SuperGroupsAndGroups
            provider: csv
            class: Group
            configuration:
                csvExample: 'superGroupName,superGroupCode,groupName,groupCode,subGroupCodes'
                delimiter: ','
                enclosure: '"'
                csvHeaders: null
paulverdu commented 1 month ago

Hmm i see something went wrong pulling those latest 5.1 changes

paulverdu commented 1 month ago

@dpfaffenbauer I see there is only a 5.1 tag and a 5.0 branch. Are these 5.1 changes gonna be merged in a master or main branch?

paulverdu commented 1 month ago

Unfortunately it is still broken. Even when changing the yaml as described above. Am I still doing something wrong here?

dpfaffenbauer commented 1 month ago

I will check next week when I am in office ok

paulverdu commented 1 month ago

Yeah sure! No problem. Thanks :)

Have a nice weekend

dpfaffenbauer commented 1 month ago

@paulverdu can you try this https://github.com/instride-ch/pimcore-data-definitions/pull/417