Answer the question
In order to leave comments, you need to log in
How to create a form so that the values in the select are values from the related (ManyToOne) entity?
there are two things related
class Cars
{
/**
* @var int
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Price", mappedBy="car")
*/
private $price;
}
class Price
{
/**
* @var int
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Cars", inversedBy="price")
* @ORM\JoinColumn(name="car_alias", referencedColumnName="id")
*/
private $car;
}
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