Element_OphCoTherapyapplication_PatientSuitability::validateDateNotInFuture PHP Method

validateDateNotInFuture() public method

validate a date is not in the future (assumes that date attributes already converted to mysql date format).
public validateDateNotInFuture ( $attribute )
$attribute - the element attribute that must be an earlier date
    public function validateDateNotInFuture($attribute)
    {
        if ($this->{$attribute} && DateTime::createFromFormat('Y-m-d', $this->{$attribute}) > new DateTime()) {
            $this->addError($attribute, $this->getAttributeLabel($attribute) . ' cannot be in the future');
        }
    }