Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove \DateTimeInterface reference from constraint validators #10302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update Time.rst
  • Loading branch information
ro0NL authored Sep 8, 2018
commit 14ffe686f9852de8c6bb0dbe16c259efb58fea9b
9 changes: 7 additions & 2 deletions reference/constraints/Time.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Time
====

Validates that a value is a valid time, meaning an object implementing
``DateTimeInterface`` or a string (or an object that can be cast into a string)
Validates that a value is a valid time, meaning a string (or an object that can be cast into a string)
that follows a valid ``HH:MM:SS`` format.

+----------------+------------------------------------------------------------------------+
Expand Down Expand Up @@ -35,6 +34,7 @@ of the day when the event starts:
{
/**
* @Assert\Time()
* @var string A "H:i:s" formatted value
*/
protected $startsAt;
}
Expand Down Expand Up @@ -72,6 +72,11 @@ of the day when the event starts:

class Event
{
/**
* @var string A "H:i:s" formatted value
*/
protected $startsAt;

public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('startsAt', new Assert\Time());
Expand Down