protected function isValidInputForNewPage($input)
{
// validate the input given before we create the page
$this->validator = $this->Validator->make($input, $this->Page->createRules, $this->Page->messages);
$fails = $this->validator->fails();
if ($fails) {
$this->errors = $this->validator->errors()->all();
$this->message = "There were validation errors.";
}
// check to make sure that there is no duplicate slug/method out there
$duplicatePage = $this->Page->where('http_verb', $input['http_verb'])->where('slug', $input['slug'])->first();
if ($duplicatePage) {
$this->errors = $this->validator->errors()->all();
$this->errors['slug'] = 'There is already a page with this slug/verb pair';
$this->message = "There were validation errors.";
}
return count($this->errors) == 0;
}