protected function castProductObject(&$productData)
{
$nonCastableAttributes = array('sku', 'name', 'description');
foreach ($productData as $key => &$data) {
if (in_array($key, $nonCastableAttributes, true) === true) {
continue;
}
$data = $this->try_cast($data);
if (is_array($data) === false) {
$data = explode('|', $data);
if (count($data) == 1) {
$data = $data[0];
$data = $this->try_cast($data);
} else {
foreach ($data as &$element) {
$element = $this->try_cast($element);
}
}
}
}
}