Answer the question
In order to leave comments, you need to log in
How to organize bidirectional communication in Symfony 4?
You need to get all agents for realty.
Realty can have any number of Agents. Connected through 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;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question