Answer the question
In order to leave comments, you need to log in
How to create a field under the mappedBy="" link?
To make the question more understandable, I’ll tell you a few words about how symphony allows, in the form of creating one entity, to immediately display the form to fill in another, related entity.
Let's say we have a client entity with a passport field. At the same time, the passport is a separate entity with its own parameters.
Entity-level communication:
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Passport", inversedBy="client", cascade={"persist", "merge"})
* @ORM\JoinColumn(nullable=false)
*/
private $passport;
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
// ...
->add('passport', PassportType::class)
/**
* @ORM\OneToMany(targetEntity="App\Entity\Property", mappedBy="client")
*/
private $property;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Client", inversedBy="property", cascade={"persist", "merge"})
* @ORM\JoinColumn(nullable=false)
*/
private $client;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question