2
Symfony2와 ignoreNull 작동하지 않음 - UniqueEntity이 필드Symfony2 - UniqueEntity 두 개의 필드
내가 널 (null) 값으로 포트를 추가하려고// src/AppBundle/Entity/Service.php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity
* @UniqueEntity(
* fields={"host", "port"},
* errorPath="port",
* message="This port is already in use on that host."
*)
*/
class Service
{
/**
* @ORM\ManyToOne(targetEntity="Host")
*/
public $host;
/**
* @ORM\Column(type="integer", nullable = true)
*/
public $port;
}
에 함께 ignoreNull 작동하지, 그것은이 포트는 호스트에 이미 사용 "던져. " 오류.
포트가 null 일 때 유효성 검사를 무시하고 싶습니다.
호스트를 추가하지 않고 포트 = null 여러 항목을 허용하고 싶습니다. –