/**
* @param array $data
*
* @return array
*/
private function prepareEsdSerialsAssociation($data, Esd
$esd) { // Remove old serials
foreach ($esd->
getSerials() as $serial) { $found = false;
foreach ($data['esd'
]['serials'
] as $newSerial) { if ($newSerial['serialnumber'
] ===
$serial->
getSerialnumber()) { $serial->
fromArray($newSerial);
$found = true;
break;
} } if ($found === false
) { $this->manager->
remove($serial);
$esd->
getSerials()->
removeElement($serial);
} }