aleksip / plugin-data-transform

Data Transform Plugin for Pattern Lab PHP
GNU General Public License v2.0
34 stars 10 forks source link

addcslashes() throws warning when passed objects in PatternDataNodeTrait.php #9

Closed illepic closed 7 years ago

illepic commented 7 years ago

Using the Pattern Lab Faker plugin can sometimes generate objects instead of strings from data.json values. For instance:

"timestamp": "2016-05-21T17:02:39+00:00",
"test_timestamp": "Faker.dateTime()",

test_timestamp would be a DateTime object sent to Twig, instead of, say, an ISO string. This situation results in the following warning:

Warning: addcslashes() expects parameter 1 to be string, object given in /home/illepic/dev/downfall-guild/project/build/dev/d8/themes/custom/patternlab/pattern-lab/vendor/aleksip/plugin-data-transform/src/aleksip/DataTransformPlugin/Twig/PatternDataNodeTrait.php on line 45

Note: I'm using the preconfiguration of Pattern Lab Starter which enables both Faker and DataTransformer plugins.

aleksip commented 7 years ago

Hi @illepic, there is now a fix for this in the dev branch. Please check it out and let me know how it works for you.

aleksip commented 7 years ago

The fix is now in v1.1.0.