public function insertCar($car) { $error = false; //type if (trim($car->getType()) == "") { $phpError["type"] = "Type is a required field!"; $error = true; } /* $dalCar = new DALCar(); $nrCars=$dalCar->getCarByTypeExcludeId($car->getType(),$car->getId()); if ($nrCars != 0) { $phpError["type"] = "This type is allready used!"; $error = true; } */ //previewlink if (trim($car->getPreviewLink()) == "") { $phpError["previewlink"] = "Preview link is a required field!"; $error = true; } elseif (!isValidURL($car->getPreviewLink())) { $phpError["previewlink"] = "Preview link must be a youtube link!"; $error = true; } //releasedate $date = $car->getReleaseDate(); if (substr($date, 0, 4) == "0000" || substr($date, 5, 2) == "00") { $phpError["releasedate"] = "Release date is a required field!"; $error = true; } //presscontact $dalPressContact = new DALPressContact(); $nrpresscontacts = $dalPressContact->getPressContactCount($car->getPressContactId()); if ($nrpresscontacts == 0) { $phpError["presscontact"] = "Presscontact was not found!"; $error = true; } if ($error == true) { return $phpError; } else { $id = parent::insertCar($car); return $id; } }