class Profile {
/** @OneToMany(targetEntity="Link", mappedBy="owner") */
private $links;
}
class Link {
/**
* @ManyToOne(targetEntity="Profile", inversedBy="links")
* @JoinColumn(name="owner_id", referencedColumnName="id")
*/
public $owner;
/**
* @ManyToOne(targetEntity="Profile")
* @JoinColumn(name="subject_id", referencedColumnName="id")
*/
public $subject;
}
$em->findBy(array("owner"=>$owner,"subject"=>$subject));
gives Unrecognized field: owner
Orada tabii bir çözüm, ama çirkin görünüyor
$em
->createQuery('SELECT l FROM \Dating\Models\Link l WHERE l.owner = ?1 AND l.subject = ?2')
->setParameter(1,$owner)
->setParameter(2,$subject)
->getResult();
Benim kendi yöntemini yazmadan findBy kullanarak herhangi bir şans var mı?