Class with multiple localizedfields (api)


#1

I have a data object that has two different localizedfields and I’m creating a migration script. I can’t seem to set one of the localizedfields. One will get a value but not the other.

image

This is within a block that holds two localizedfields. Also, for the field in question, I keep getting this:
WARNING [pimcore] class definition seems to have changed, element name: measurementName.

I’ve tried various ways and this below creates the block elements, but it doesn’t fill in measurementName
$data = [
‘measurementLetter’ => new BlockElement(‘measurementLetter’, ‘input’, $om[‘MeasurementLetter’]->getData()),
‘sizeAll’ => new BlockElement(‘sizeAll’, ‘input’, $om[‘SizeAll’]->getData()),
‘sizeTolerance’ => new BlockElement(‘sizeTolerance’, ‘input’, $om[‘SizeTolerance’]->getData()),
‘size4T’ => new BlockElement(‘size4T’, ‘input’, $om[‘Size4T’]->getData()),
‘size3T’ => new BlockElement(‘size3T’, ‘input’, $om[‘Size3T’]->getData()),
‘size0mo’ =>new BlockElement(‘size0mo’, ‘input’, $om[‘Size0mo’]->getData()),
‘size3mo’ => new BlockElement(‘size3mo’, ‘input’, $om[‘Size3mo’]->getData()),
‘size6mo’ => new BlockElement(‘size6mo’, ‘input’, $om[‘Size6mo’]->getData()),
‘size9mo’ => new BlockElement(‘size9mo’, ‘input’, $om[‘Size9mo’]->getData()),
‘size12mo’ => new BlockElement(‘size12mo’, ‘input’, $om[‘Size12mo’]->getData()),
‘size18mo’ => new BlockElement(‘size18mo’, ‘input’, $om[‘Size18mo’]->getData()),
‘size24mo’ => new BlockElement(‘size24mo’, ‘input’, $om[‘Size24mo’]->getData()),
‘localizedfields’ => new BlockElement(‘localizedfields’, ‘localizedfields’, new DataObject\Localizedfield([
“en_US” => [
“methodDescr” => $om[‘MethodDescr’]->getData(),
‘measurementName’ => $om[‘MeasurementName’]->getData(),
]
])
),
‘galMethodPhoto’ => new BlockElement(‘galMethodPhoto’, ‘Image Gallery’, $gal)
];
array_push($blk_data, $data);
}

            $pattern->setBlkMeasurementList($blk_data);

#2

Doh. I got it. I didn’t see where it explicitly said one per class in the docs, but it does say, “put all of your inputs that need translations…” So, only one per.