The createDuplicate() method in it's current form won't work as it just returns the array from the Exporter::import() method, this also needs to be passed to create() to actually construct the Exportable object.

Whilst looking at this, I also realised that the current logic for dealing with serialized fields won't work. We could be loading a serialized string from the database, or the data array could be from import, in which case the any serialized arrays would already be constructed. So we need to check if it is a string, but also that it isn't an empty string.

This will need some tests to check that the duplicated exportable is the same. Which could be more difficult to compare; for example, if a duplicate object is created from a default, isInCode() will not be set, so we will need to bear this in mind for the tests.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damiankloip’s picture

damiankloip’s picture

Instead of just checking if the serialized string is empty we could try to unserialize and see if we have a result, if not, then use the string?

damiankloip’s picture

Issue tags: +VDC

.

merlinofchaos’s picture

This looks good to me.

damiankloip’s picture

RTBC good? :)

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine for me as well

damiankloip’s picture

Assigned: Unassigned » damiankloip

Ok, thanks!

tim.plunkett’s picture

damiankloip’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.