BlackbitDigitalCommerce / pimcore-data-director

Import Bundle for Pimcore
16 stars 3 forks source link

Object hierarchy #36

Open betterapp opened 2 years ago

betterapp commented 2 years ago

return 'ClassName:fieldName:'.$params['value'];

What it will return if object will be not found ? Is it possible that it will return bool value ?

Documentation say: DD try to create that object - is that right ? But what if it can not create it ?

BlackbitDevs commented 2 years ago

For all fields except Path it will return the data object (if found) or false if not found. Only for field Path this object will get created (because classname is known and in the resulting object this one filter field which got used will get populated, object is unpublished). This is mainly for when you have imported the data in the wrong order - when we would not create those dummy parent elements, the import would fail. The Data Director usually tries to be as tolerant concerning human mistakes as possible.

You can see this behaviour when putting return 'Product:key:non-existing-key:json_encode'; somewhere.

But what if it can not create it ? Then there is a warning log and the raw data item gets skipped.

I am currently preparing a video about data query selectors because they are so powerful but people most often have some problems with them initially. For Pimcore-bases dataports in the raw data fields there is autocompletion for common use-cases, but nevertheless some more explanation is a good idea imho - especially because with version 3.1 you can use data query selectors as grid operators which is much easier than with the native grid operators imho.

betterapp commented 2 years ago

I think if it will not find it should return NULL not false.

PimCore use NULL for not existed relation object. In this case if we have some events and check if field is not null and try to take data from object we got error

You tried getName() on bool ;)

BlackbitDevs commented 2 years ago

Hehe, yes, also wondered about this. Perhaps will change this, but didn't you ask Is it possible that it will return bool value ?? ;-) Will check where this boolean comes from...

betterapp commented 2 years ago

;)

betterapp commented 2 years ago

Is it possible that return false is only on DD 3.X ? We did not see this problem on 2.8

BlackbitDevs commented 2 years ago

Might be, as far as I know formerly it returned the string "ClassName:fieldName:abc" (or whatever value $params['value'] has). Or what have you got in 2.8?

betterapp commented 2 years ago

I do not know because we updated to 3.X ;)

BlackbitDevs commented 2 years ago

Fixed it in 3.1. For Product:key:non-existing:gettype you now get NULL.

betterapp commented 2 years ago

but there is no tag for 3.1 yet

BlackbitDevs commented 2 years ago

Yes, because it is not released yet. You can use 3.1.x-dev but try on a test instance first.