<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
happyr / entity-exists-validation-constraint example snippets
namespace App\Message\Command;
use Happyr\Validator\Constraint\EntityExist;
use Symfony\Component\Validator\Constraints as Assert;
final class EmailUser
{
/**
* @Assert\NotBlank
* @EntityExist(entity="App\Entity\User")
*
* @var int User's id property
*/
private $user;
/**
* @Assert\NotBlank
* @EntityExist(entity="App\Entity\Other", property="name")
*
* @var string The name of "Other". We use its "name" property.
*/
private $other;
// ...
namespace App\Message\Command;
use Happyr\Validator\Constraint\EntityExist;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @Assert\GroupSequence({"EmailUser", "DatabaseCall"})
*/
final class EmailUser
{
/**
* @Assert\NotBlank
* @Assert\Uuid
* @EntityExist(entity="App\Entity\User", groups={"DatabaseCall"}, property="uuid")
*
* @var string Uuid
*/
private $user;
// ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.