2
Dernek Doctrine2 ile ilgili bir sorunum var.Doctrine2'deki başka bir varlıktan erişin.
Benim Varlık haritalama geçerli: Marka:
/**
* @ORM\Entity
*/
class Brand
{
/**
* @ORM\Id
*/
protected $id;
/**
* @ORM\Column(type="string")
*/
protected $name;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Model", mappedBy="brand")
*/
protected $models;
/**
* @ORM\Column(type="boolean")
*/
protected $isPopular;
}
Modeli:
/**
* @ORM\Entity
*/
class Model
{
/**
* @ORM\Id
*/
protected $id;
/**
* @ORM\Column(type="string")
*/
protected $name;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\VehicleType", inversedBy="models")
* @ORM\JoinColumn(name="vehicle_type_id", referencedColumnName="id")
*/
protected $vehicleType;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Brand", inversedBy="models")
* @ORM\JoinColumn(name="brand_id", referencedColumnName="id")
*/
protected $brand;
}
VehicleType:
/**
* @ORM\Entity
*/
class VehicleType
{
/**
* @ORM\Id
*/
protected $id;
/**
* @ORM\Column(type="string")
*/
protected $name;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Model", mappedBy="vehicleType")
*/
protected $models;
}
I (popüler markalar Varlık VehicleType dizisindeki markayı nasıl alabilirim .isPopular = true)? Мay haritam yanlış mı?