Exemple #1
0
 public static function contextify(SelectQuery $query)
 {
     $limit = self::$request->get("l")->filter(Filter::isNumber())->filter(Filter::isPositiveNumber());
     $offset = self::$request->get("o")->filter(Filter::isNumber())->filter(Filter::isPositiveNumber());
     $sort_field = self::$request->get("sf");
     $sort_order = self::$request->get("so");
     $max_limit = self::$settings->get("catalog", "items_per_request_limit");
     $limit->then([$query, "limit"]);
     $offset->then([$query, "offset"]);
     //        $query->limit($limit->filter(Filter::isLessThan($max_limit))->getOrElse($max_limit));
     //        $query->offset($offset->orZero());
 }
 public function validate()
 {
     $this->_name = $this->name->orThrow(ValidatorException::class, "Enter playlist name")->filter(Filter::lengthInRange(1, VALIDATOR_PLAYLIST_NAME_MAX_LENGTH))->getOrThrow(ValidatorException::class, sprintf("Playlist name must be in range from 1 to %d chars", VALIDATOR_PLAYLIST_NAME_MAX_LENGTH));
 }
Exemple #3
0
 protected function validate()
 {
     $this->_email = $this->email->orThrow(ValidatorException::class, "You must specify your email")->filter(Filter::matchRegExp(VALIDATOR_EMAIL_TEMPLATE))->getOrThrow(ValidatorException::class, "You must specify correct email");
     $this->_password = $this->password->orThrow(ValidatorException::class, "You must specify your password")->filter(Filter::lengthInRange(VALIDATOR_PWD_MIN_LENGTH, VALIDATOR_PWD_MAX_LENGTH))->getOrThrow(ValidatorException::class, sprintf("Password must be in range from %d to %d chars", VALIDATOR_PWD_MIN_LENGTH, VALIDATOR_PWD_MAX_LENGTH));
 }