Last active
December 12, 2018 21:27
-
-
Save vudaltsov/0f375bc93c78f904636161391923ded3 to your computer and use it in GitHub Desktop.
Domain constraints for Symfony Validator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Validator\Constraints as Assert; | |
final class NewsDto | |
{ | |
/** | |
* @Assert\NotNull() | |
* @Assert\Type("string") | |
* @Assert\Length(min=5, max=50) | |
* @Assert\Regex("/^[a-z0-9-]$/", message="Slug must be composed of lowercase latin letters, digits and dashes.") | |
* | |
* @var null|string | |
*/ | |
public $slug; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment