0
I have an Intervention Ntity, a Breakdown and a Forecast One and I wanted to go and eat the data of these Ntity and put it all together in one table.
The table that joins everything will be inside the Intervention Entity within a detail.html file.
Table will be: Intervention: Date, Time and Duration; Malfunction: Date, Description and Impediment; Scheduled: Count, Duration, Make, Time and Record;
My chart looks like this: Worker Intervention Breakdown Planned Id Identity Date Time Duration Date Description Deterrent Counting Duration Do Weather Token {% for Entity in entities %} {% if Entity.data %}{{ Entity.data|date('Y-m-d') }}{% endif %} {% if Entity.horainicio %}{{ Entity.horainicio|date('H:i') }}{% endif %} {{ Entity.duracao }} {% endfor %}
How do I get the data from the other Entity to this table?
The relationships between them are: In Intervention:
/**
* @ORM\ManyToOne(targetEntity="RoqSys\Control\ManutencaoBundle\Entity\Maquina", inversedBy="intervencao")
* @ORM\JoinColumn(name="maquina_id", referencedColumnName="id", nullable=false)
*/
private $maquina;
In Breakdown:
/**
* @ORM\ManyToOne(targetEntity="RoqSys\Control\ManutencaoBundle\Entity\Maquina", inversedBy="avaria")
* @ORM\JoinColumn(name="maquina_id", referencedColumnName="id")
*/
private $maquina;
In Forecasted:
/**
* @ORM\ManyToOne(targetEntity="RoqSys\Control\ManutencaoBundle\Entity\Maquina", inversedBy="prevista")
* @ORM\JoinColumn(name="maquina_id", referencedColumnName="id")
*/
private $maquina;
In the Intervencaocontroller:
/**
* Lists all Intervencao entities.
*
* @Route("/", name="manutencao_intervencao")
* @Method("GET")
* @Template()
*/
public function indexAction() {
$em = $this->getDoctrine()->getManager();
$entities =$em->getRepository('RoqSysControlManutencaoBundle:Intervencao')->findAll();
$avarias = $em->getRepository('RoqSysControlManutencaoBundle:Avaria')->findAll();
$previstas = $em->getRepository('RoqSysControlManutencaoBundle:Prevista')->findAll();
return array(
'entities' => $entities,
'avarias' => $avarias,
'previstas' => $previstas,
);
}
What is the relationship that entities (
Intervencao
,Avaria
andPrevista
) own with each other? Manytoone, Manytomany, Onetomany, Onetoone etc.– Rodrigo Rigotti
Na intevenção: /**
 * @ORM\ManyToOne(targetEntity="RoqSys\Control\ManutencaoBundle\Entity\Maquina", inversedBy="intervencao")
 * @ORM\JoinColumn(name="maquina_id", referencedColumnName="id", nullable=false)
 */
 private $maquina;
– Catarina Silvestre