Ich bin mit dem ramsey/uuid-doctrine Paket binär UUIDs als Primärschlüssel für ein Unternehmen führen:uuid_binary Form Validierungsfehler: Die Wahl existiert nicht oder ist nicht eindeutig
class Site
{
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="UUID")
* @ORM\Column(type="uuid_binary")
*/
private $id;
...
}
Ich brauche ein Formular für einen anderen bauen Entität, die diese Entität in einer ManyToOne-Beziehung hat. So
Ich habe in meinen Formular-Builder, ein EntityType wie folgt:
$builder->add('site')
Alles funktioniert, wählen Sie die HTML hat die UUIDs als Schlüssel, aber wenn ich das Formular abschicken Ich erhalte diesen Validierungsfehler:
Symfony\Component\Validator\ConstraintViolation Object(Symfony\Component\Form\Form).children[site] = 4a41b3c4-4299-11e6-b562-fc3fdb5f816d
Caused by: Symfony\Component\Form\Exception\TransformationFailedException Unable to reverse value for property path "site": The choice "4a41b3c4-4299-11e6-b562-fc3fdb5f816d" does not exist or is not unique
Caused by: Symfony\Component\Form\Exception\TransformationFailedException The choice "4a41b3c4-4299-11e6-b562-fc3fdb5f816d" does not exist or is not unique
Wenn ich das tue, in einem Controller:
$this->getDoctrine()->getManager()
->getRepository('AppBundle:Site')->find('4a41b3c4-4299-11e6-b562-fc3fdb5f816d');
Es findet die Entität, also existiert sie.