I need to "connet" an instance of HolidayPackage to Discount (one-to-one) and be able to fetch join when getting data from the repository. I.e:
// Inside a method of HolidayPackageRepository repository class $qb = $this->createQueryBuilder($alias = 'hp'); $qb->leftJoin("$alias.discount", 'd') ->addSelect('d'); // fetch join The problem is that discount table is deleted and filled again every couple of hour, so discount_id cannot be a real foreign key. However identifiers may stay the same:
/** * @ORM\Entity() * @ORM\Table("holiday_package") */ class HolidayPackage { /** * @ORM\Column(name="discount_id", type="integer", nullable=true) * * @var null|Discount */ private $discount; } How can I fetch join without a real foreign key?