/** * @param $id * @return Main\Entity\DeleteResult * @throws Main\ArgumentException * @throws Main\ArgumentNullException */ public static function deleteWithItems($id) { $id = intval($id); if ($id <= 0) { throw new Main\ArgumentNullException("id"); } $itemsList = ShipmentItemTable::getList(array("filter" => array("ORDER_DELIVERY_ID" => $id), "select" => array("ID"))); while ($item = $itemsList->fetch()) { ShipmentItemTable::deleteWithItems($item["ID"]); } return ShipmentTable::delete($id); }