database = $database; $this->collection = $collection; } /** * Get Description. * * Returns validator description * * @return string */ public function getDescription() { return $this->message; } /** * Is valid. * * Returns true if valid or false if not. * * @param $value * * @return bool */ public function isValid($id) { $document = $this->database->getDocument($id); if (!$document) { return false; } if (!$document instanceof Document) { return false; } if (!$document->getId()) { return false; } if ($document->getCollection() !== $this->collection) { return false; } return true; } }