src/Entity/UserInfo.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Symfony\Component\Validator\Constraints as Assert;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Entity\Traits\IdTrait;
  7. use App\Entity\Traits\SubjectTrait;
  8. use App\Entity\Traits\TitleTrait;
  9. use App\Entity\Traits\QualificationTrait;
  10. use App\Entity\Traits\DegreeTrait;
  11. use App\Entity\Traits\CollegeTrait;
  12. use App\Entity\Traits\NumberMethodTrait;
  13. use App\Entity\Traits\NameTrait;
  14. /**
  15.  *
  16.  * @ORM\Entity(repositoryClass="App\Repository\UserInfoRepository")
  17.  * @ORM\Table(name="user_info")
  18.  * @UniqueEntity("number")
  19.  */
  20. class UserInfo
  21. {
  22.     use IdTraitNameTraitNumberMethodTraitSubjectTraitTitleTraitQualificationTraitDegreeTraitCollegeTrait;
  23.     const GENDER_MAN '男';
  24.     const GENDER_WOMAN '女';
  25.     const GENDERS = [
  26.         self::GENDER_MAN,
  27.         self::GENDER_WOMAN
  28.     ];
  29.     //@Assert\Regex("/^\d{17,17}\w/",message="格式错误")
  30.     /**
  31.      *
  32.      * @ORM\Column(length=18, unique=true)
  33.      * 
  34.      */
  35.     protected $number;
  36. //
  37.     /**
  38.      *
  39.      * @ORM\Column(length=2)
  40.      * @Assert\Choice(choices=UserInfo::GENDERS)
  41.      */
  42.     protected $gender;
  43.     /**
  44.      *
  45.      * @ORM\Column
  46.      * @Assert\NotBlank()
  47.      */
  48.     protected $major;
  49.     /**
  50.      *
  51.      * @ORM\Column
  52.      * @Assert\Regex("/^\d{3,4}-\d{7,8}/",message="格式错误")
  53.      */
  54.     protected $phone;
  55.     /**
  56.      *
  57.      * @ORM\Column(length=11)
  58.      * @Assert\Regex("/^1\d{10,10}/",message="格式错误")
  59.      */
  60.     protected $mobile;
  61.     /**
  62.      *
  63.      * @ORM\Column
  64.      * @Assert\Email
  65.      */
  66.     protected $email;
  67.     /**
  68.      *
  69.      * @ORM\Column
  70.      * @Assert\NotBlank()
  71.      */
  72.     protected $address;
  73.     /**
  74.      *
  75.      * @ORM\Column(length=6)
  76.      * @Assert\Regex("/^\d{6,6}/",message="格式错误")
  77.      * @Assert\NotBlank()
  78.      */
  79.     protected $zipcode;
  80.     public function getGender(): string
  81.     {
  82.         return $this->gender;
  83.     }
  84.     public function setGender(string $gender)
  85.     {
  86.         $this->gender $gender;
  87.     }
  88.     public function getMajor(): string
  89.     {
  90.         return $this->major;
  91.     }
  92.     public function setMajor(string $major)
  93.     {
  94.         $this->major $major;
  95.     }
  96.     public function getPhone(): string
  97.     {
  98.         return $this->phone;
  99.     }
  100.     public function setPhone(string $phone)
  101.     {
  102.         $this->phone $phone;
  103.     }
  104.     public function getMobile(): string
  105.     {
  106.         return $this->mobile;
  107.     }
  108.     public function setMobile(string $mobile)
  109.     {
  110.         $this->mobile $mobile;
  111.     }
  112.     public function getEmail(): string
  113.     {
  114.         return $this->email;
  115.     }
  116.     public function setEmail(string $email)
  117.     {
  118.         $this->email $email;
  119.     }
  120.     public function getAddress(): string
  121.     {
  122.         return $this->address;
  123.     }
  124.     public function setAddress(string $address)
  125.     {
  126.         $this->address $address;
  127.     }
  128.     public function getZipcode(): string
  129.     {
  130.         return $this->zipcode;
  131.     }
  132.     public function setZipcode(string $zipcode)
  133.     {
  134.         $this->zipcode $zipcode;
  135.     }
  136. }