I have 2 entities:
class Act
{
/**
* @Assert\Count(min=1)
* @Assert\Valid(traverse=true)
* @ORM\OneToMany(targetEntity="App\Entity\ActItem", mappedBy="act", cascade={"persist"})
*/
private $items;
}
class ActItem
{
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Act", inversedBy="items")
* @ORM\JoinColumn(nullable=false)
*/
private $act;
/**
* @Assert\NotNull
* @Assert\Type("float")
*
* @ORM\Column(type="float")
*/
private $count;
}
ActItem has Assert\NotNull, but when I try to create/update act with item like {count: null} then I get response:
hydra:description: "The type of the "count" attribute must be "float", "NULL" given."
I notice that if I remove @ORM\Column(type="float") then I get:
hydra:description: "items[0].count: This value should not be blank."
So why it working like this? How can i make it work in another order?