2
Doctrine2でAssociationに問題があります。Doctrine2の別のエンティティ経由でアクセスする
私のエンティティのマッピングは次のとおりです。 ブランド:
/**
* @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;
}
モデル:
/**
* @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:私は人気ブランドのエンティティ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;
}
(ブランド.isPopular = true)? 私のマッピングは間違っていますか?