Oturumunu, Kişi, Katılımcı olması ile, ben katılımcıları kontrol etmek için bir Oturum ve tüm Kişilerin ile bir liste oluşturmak için çalışıyorum .Symfony'nin özel birçok çoğa onay kutusu
s ve session_id
s tabloları, participants_id
s ve session_id
tutar.
aşağıdaki hata alıyorum:
Unable to transform value for property path "person": Expected a Doctrine\Common\Collections\Collection object.
Bir Oturumu oluşturmak ve doğrudan aynı formda katılımcılara kontrol etmek istiyorum.
PersonEntityType
class PersonEntityType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name');
}
}
SessionEntityType
class SessionEntityType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('description')
->add('participant', CollectionType::class,
array(
'entry_type' => ParticipantEntityType::class,
'by_reference' => false,
'allow_add' => true,
'allow_delete' => true,
)
);
}
}
ParticipantEntityType
class ParticipantEntityType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('person', EntityType::class,
array(
'class' => 'AppBundle:PersonEntity',
'choice_label' => 'name',
'expanded' =>'true',
'multiple' => 'true'
)
);
}
}
PersonEntity
class PersonEntity
{
private $id;
private $name;
/**
* @ORM\OneToMany(targetEntity="ParticipantEntity", mappedBy="person")
*/
private $participant;
public function __construct()
{
$this->participant = new ArrayCollection();
}
}
SessionEntity
class SessionEntity
{
private $id;
private $description;
/**
* @ORM\OneToMany(targetEntity="ParticipantEntity", mappedBy="session")
*/
private $participant;
public function __construct()
{
$this->participant = new ArrayCollection();
}
}
ParticipantEntity
class ParticipantEntity
{
private $id;
/**
* @ORM\ManyToOne(targetEntity="PersonEntity", inversedBy="participant")
*/
private $person;
/**
* @ORM\ManyToOne(targetEntity="SessionEntity", inversedBy="participant")
*/
private $session;
public function __construct()
{
$this->person = new ArrayCollection();
}
}
Sen olmalıdır
Lütfen, ** PersonEntity ** –
kodunu göster Lütfen, 'SessionEntity' ve' ParticipantEntity' kodlarını göstermelisiniz – Heah