-1
我有以下Task
類/實體:由另一實體的關係找到實體
/**
* @ORM\Entity
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="discr", type="string")
* @DiscriminatorMap({"task" = "Task", "upload" = "UploadTask", "follow" = "FollowTask", "like" = "LikeTask", "comment" = "CommentTask", "scape" = "ScrapeTask"})
*/
class Task
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="PlayBot\UserBundle\Entity\User", inversedBy="task")
* @ORM\JoinColumn(name="account_id", referencedColumnName="id")
*/
protected $account;
/**
* @ORM\ManyToOne(targetEntity="PlayBot\PlayBundle\Entity\Interval", inversedBy="task")
* @ORM\JoinColumn(name="interval_id", referencedColumnName="id", nullable=true)
*/
protected $interval = NULL;
}
及以下Interval
類:
/**
* @ORM\Entity
* @ORM\Table(name="interval")
*/
class Interval
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\OneToMany(targetEntity="PlayBot\PlayBundle\Entity\Task", mappedBy="interval")
*/
protected $task;
/**
* @ORM\Column(type="integer")
*/
protected $interval;
}
我想找到所有Task
有一個Interval
「 s $interval
設置爲20
。
我該怎麼做?