pimcore-data-definitions icon indicating copy to clipboard operation
pimcore-data-definitions copied to clipboard

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

Open paulverdu opened this issue 1 year ago • 10 comments

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 avatar Aug 04 '24 07:08 paulverdu

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 avatar Aug 04 '24 08:08 paulverdu

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.

paulverdu avatar Aug 04 '24 08:08 paulverdu

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.

dpfaffenbauer avatar Aug 04 '24 08:08 dpfaffenbauer

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 avatar Aug 04 '24 08:08 paulverdu

Hmm i see something went wrong pulling those latest 5.1 changes

paulverdu avatar Aug 04 '24 08:08 paulverdu

@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 avatar Aug 04 '24 08:08 paulverdu

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

paulverdu avatar Aug 04 '24 09:08 paulverdu

I will check next week when I am in office ok

dpfaffenbauer avatar Aug 04 '24 09:08 dpfaffenbauer

Yeah sure! No problem. Thanks :)

Have a nice weekend

paulverdu avatar Aug 04 '24 09:08 paulverdu

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

dpfaffenbauer avatar Aug 05 '24 05:08 dpfaffenbauer

ID's are implemented again like before, so closing this issue

paulverdu avatar Nov 25 '24 08:11 paulverdu