<?php
namespace App\Entity;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Traits\IdTrait;
use App\Entity\Traits\SubjectTrait;
use App\Entity\Traits\TitleTrait;
use App\Entity\Traits\QualificationTrait;
use App\Entity\Traits\DegreeTrait;
use App\Entity\Traits\CollegeTrait;
use App\Entity\Traits\NumberMethodTrait;
use App\Entity\Traits\NameTrait;
/**
*
* @ORM\Entity(repositoryClass="App\Repository\UserInfoRepository")
* @ORM\Table(name="user_info")
* @UniqueEntity("number")
*/
class UserInfo
{
use IdTrait, NameTrait, NumberMethodTrait, SubjectTrait, TitleTrait, QualificationTrait, DegreeTrait, CollegeTrait;
const GENDER_MAN = '男';
const GENDER_WOMAN = '女';
const GENDERS = [
self::GENDER_MAN,
self::GENDER_WOMAN
];
//@Assert\Regex("/^\d{17,17}\w/",message="格式错误")
/**
*
* @ORM\Column(length=18, unique=true)
*
*/
protected $number;
//
/**
*
* @ORM\Column(length=2)
* @Assert\Choice(choices=UserInfo::GENDERS)
*/
protected $gender;
/**
*
* @ORM\Column
* @Assert\NotBlank()
*/
protected $major;
/**
*
* @ORM\Column
* @Assert\Regex("/^\d{3,4}-\d{7,8}/",message="格式错误")
*/
protected $phone;
/**
*
* @ORM\Column(length=11)
* @Assert\Regex("/^1\d{10,10}/",message="格式错误")
*/
protected $mobile;
/**
*
* @ORM\Column
* @Assert\Email
*/
protected $email;
/**
*
* @ORM\Column
* @Assert\NotBlank()
*/
protected $address;
/**
*
* @ORM\Column(length=6)
* @Assert\Regex("/^\d{6,6}/",message="格式错误")
* @Assert\NotBlank()
*/
protected $zipcode;
public function getGender(): string
{
return $this->gender;
}
public function setGender(string $gender)
{
$this->gender = $gender;
}
public function getMajor(): string
{
return $this->major;
}
public function setMajor(string $major)
{
$this->major = $major;
}
public function getPhone(): string
{
return $this->phone;
}
public function setPhone(string $phone)
{
$this->phone = $phone;
}
public function getMobile(): string
{
return $this->mobile;
}
public function setMobile(string $mobile)
{
$this->mobile = $mobile;
}
public function getEmail(): string
{
return $this->email;
}
public function setEmail(string $email)
{
$this->email = $email;
}
public function getAddress(): string
{
return $this->address;
}
public function setAddress(string $address)
{
$this->address = $address;
}
public function getZipcode(): string
{
return $this->zipcode;
}
public function setZipcode(string $zipcode)
{
$this->zipcode = $zipcode;
}
}