public function validation()
{
$validator = new Validation();
/**
* ISO
*/
$validator->add('iso', new Uniqueness(['model' => $this, "message" => "The inputted ISO language is existing"]));
$validator->add('iso', new PresenceOf(['model' => $this, 'message' => 'ISO is required']));
/**
* Name
*/
$validator->add('name', new Uniqueness(['model' => $this, "message" => "The inputted name is existing"]));
$validator->add('name', new PresenceOf(['model' => $this, 'message' => 'Name is required']));
/**
* URL
*/
$validator->add('url', new Uniqueness(['model' => $this, "message" => "The inputted URL is existing"]));
if ($this->primary == 0) {
$validator->add('url', new PresenceOf(['model' => $this, 'message' => 'URL is required']));
}
return $this->validationHasFailed() != true;
}