DateTimeConstraint example

if ($toDate && $toDate <= $now) {
            return false;
        }

        return true;
    }

    public function getConstraints(): array
    {
        return [
            'fromDate' => [new NotBlank()new DateTimeConstraint(['format' => \DateTime::ATOM])],
            'toDate' => [new NotBlank()new DateTimeConstraint(['format' => \DateTime::ATOM])],
            'useTime' => [new NotNull()new Type('bool')],
        ];
    }
}
Home | Imprint | This part of the site doesn't use cookies.