Нужно получить всех agent для realty.
У Realty может быть сколько угодно Agent. Связанны через AgentRealty.
class Realty
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
}
class Agent
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
}
/**
* AgentRealty
*
* @ORM\Entity
* @ORM\Table(name="agent_realties")
*
*/
class AgentRealty
{
/**
* @ORM\OneToOne(targetEntity="App\Metrag\AppBundle\Entity\Realty")
* @ORM\JoinColumn(name="realty_id", referencedColumnName="id" )
* @ORM\Id
*/
private $realty;
/**
* @ORM\OneToOne(targetEntity="App\Metrag\AppBundle\Entity\Agent")
* @ORM\JoinColumn(name="agent_id", referencedColumnName="id" )
* @ORM\Id
*/
private $agent;
public function getRealty(): ?Realty
{
return $this->realty;
}
public function setRealty(?Realty $realty): self
{
$this->realty = $realty;
return $this;
}
public function getAgent(): ?Agent
{
return $this->agent;
}
public function setAgent(?Agent $agent): self
{
$this->agent = $agent;
return $this;
}
}