src/Form/Models/ContactezDirectementFondsInvestissement.php line 25

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * @author Raymond
  5.  * @Description il s'agit d'un modèle pour définir les différents validations utilisés dans le formulaire FormType
  6.  * Ce modèle n'interagit pas avec la base de  données
  7.  */
  8. namespace App\Form\Models;
  9. use App\Helper\Utils;
  10. use App\Validator\Constraints\ContainsOnlyAlphabetic;
  11. use App\Validator\Constraints\ContainsOnlyNumeric;
  12. use App\Validator\Constraints\Nom;
  13. use App\Validator\Constraints\PhoneNumber;
  14. use App\Validator\Constraints\Prenom;
  15. use EWZ\Bundle\RecaptchaBundle\Validator\Constraints as Recaptcha;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. use Symfony\Component\Validator\Constraints\IsTrue;
  18. use Symfony\Component\Validator\Mapping\ClassMetadata;
  19. use Symfony\Component\Validator\Constraints\NotBlank;
  20. class ContactezDirectementFondsInvestissement
  21. {
  22.     
  23.     public $nom;
  24.     public $prenom;
  25.     public $email;
  26.     public $telephone;
  27.     public $indicatif;
  28.     public $societe;
  29.     public $message;
  30.     public $parametre;
  31.     /**
  32.      * @Recaptcha\IsTrue(message="captcha invalide")
  33.      */
  34.     public $recaptcha;
  35.     
  36.     public $id_gestionnaire_fonds;
  37.     public $lang;
  38.     
  39.     public function _get($property)
  40.     {
  41.         return $this->$property;
  42.     }
  43.     
  44.     /**
  45.      * Magic setter to save public properties.
  46.      *
  47.      * @param string $property
  48.      * @param mixed  $value
  49.      */
  50.     public function _set($property$value)
  51.     {
  52.         $this->$property $value;
  53.     }
  54.     
  55.     /**
  56.      * @return mixed
  57.      */
  58.     public function getNom()
  59.     {
  60.         return $this->nom;
  61.     }
  62.     
  63.     /**
  64.      * @param mixed $nom
  65.      */
  66.     public function setNom($nom): void
  67.     {
  68.         $this->nom $nom;
  69.     }
  70.     
  71.     /**
  72.      * @return mixed
  73.      */
  74.     public function getPrenom()
  75.     {
  76.         return $this->prenom;
  77.     }
  78.     
  79.     /**
  80.      * @param mixed $prenom
  81.      */
  82.     public function setPrenom($prenom): void
  83.     {
  84.         $this->prenom $prenom;
  85.     }
  86.     
  87.     /**
  88.      * @return mixed
  89.      */
  90.     public function getEmail()
  91.     {
  92.         return $this->email;
  93.     }
  94.     
  95.     /**
  96.      * @param mixed $mail
  97.      */
  98.     public function setEmail($email): void
  99.     {
  100.         $this->email $email;
  101.     }
  102.     
  103.     /**
  104.      * @return mixed
  105.      */
  106.     public function getTelephone()
  107.     {
  108.         return $this->telephone;
  109.     }
  110.     
  111.     /**
  112.      * @param mixed $telephone
  113.      */
  114.     public function setTelephone($telephone): void
  115.     {
  116.         $this->telephone $telephone;
  117.     }
  118.     
  119.     /**
  120.      * @return mixed
  121.      */
  122.     public function getSociete()
  123.     {
  124.         return $this->societe;
  125.     }
  126.     
  127.     /**
  128.      * @param mixed $societe
  129.      */
  130.     public function setSociete($societe): void
  131.     {
  132.         $this->societe $societe;
  133.     }
  134.     
  135.     /**
  136.      * @return mixed
  137.      */
  138.     public function getMessage()
  139.     {
  140.         return $this->message;
  141.     }
  142.     
  143.     /**
  144.      * @param mixed $message
  145.      */
  146.     public function setMessage($message): void
  147.     {
  148.         $this->message $message;
  149.     }
  150.     
  151.     /**
  152.      * @return mixed
  153.      */
  154.     public function getParametre()
  155.     {
  156.         return $this->parametre;
  157.     }
  158.     
  159.     /**
  160.      * @param mixed $message
  161.      */
  162.     public function setParametre($parametre): void
  163.     {
  164.         $this->parametre $parametre;
  165.     }
  166.     
  167.     /**
  168.      * @return void
  169.      */
  170.     public static function loadValidatorMetadata(ClassMetadata $metadata)
  171.     {
  172.         $metadata->addPropertyConstraint('telephone', new PhoneNumber());
  173.         $metadata->addPropertyConstraint('nom', new Nom() );
  174.         $metadata->addPropertyConstraint('prenom', new Prenom());
  175.         $metadata->addPropertyConstraint('nom', new NotBlank([  'message' => 'le champ nom est obligatoire'  ]));
  176.         $metadata->addPropertyConstraint('prenom', new NotBlank([  'message' => 'le champ prenom est obligatoire'  ]));
  177.         $metadata->addPropertyConstraint('message', new NotBlank([  'message' => 'le champ message est obligatoire'  ]));
  178.         $metadata->addPropertyConstraint('telephone', new NotBlank([  'message' => 'le champ telephone est obligatoire'  ]));
  179.         $metadata->addPropertyConstraint('societe', new NotBlank([  'message' => 'le champ société est obligatoire'  ]));
  180.         $metadata->addPropertyConstraint('email', new NotBlank([  'message' => 'le champ email est obligatoire'  ]));
  181.         $metadata->addPropertyConstraint('email', new Assert\Email([  'message' => 'le champ email est invalide'  ]));
  182.     }
  183.     
  184. }