<?php
/**
* Abstracts comment creation request parameters.
* @package diy-blog.frontend.controller.forms
* @author Martynas Jusevicius <hide@address.com>
* @link http://www.xml.lt
*/
class CommentForm extends Form
{
private $name = null;
private $title = null;
private $content = null;
private $captcha = null;
private $website = null;
public function __construct(Request $request)
{
$this->name = $request->getParameter("name");
$this->title = $request->getParameter("title");
$this->content = $request->getParameter("content");
$this->captcha = $request->getParameter("captcha");
$this->website = $request->getParameter("website");
}
public function getName()
{
return $this->name;
}
public function getTitle()
{
return $this->title;
}
public function getContent()
{
return $this->content;
}
public function getCaptcha()
{
return $this->captcha;
}
public function getWebsite()
{
return $this->website;
}
public function validate()
{
$errors = array();
//if ($this->name == null) $errors[] = new Error("noName");
//if ($this->title == null) $errors[] = new Error("noTitle");
if ($this->content == null) $errors[] = new Error("noContent");
return $errors;
}
}
?>