$data =
$this->
prepareAttributeAssociation($data,
$article,
$variant);
if (isset($data['configuratorOptions'
])) { $data =
$this->
prepareConfigurator($data,
$article,
$variant);
} if (isset($data['images'
])) { $data =
$this->
prepareImageAssociation($data,
$article,
$variant);
} if (isset($data['esd'
])) { $data =
$this->
prepareEsdAssociation($data,
$variant);
} if (!
empty($data['number'
]) &&
$data['number'
] !==
$variant->
getNumber()) { // Number changed, hence make sure it does not already exist in another variant
$exists =
$this->
getContainer() ->
get(Connection::
class) ->
fetchColumn('SELECT id FROM s_articles_details WHERE ordernumber = ?',
[$data['number'
]]);
if ($exists) { throw new CustomValidationException(sprintf('A variant with the given order number "%s" already exists.',
$data['number'
]));
} }