When I try to display the information from the tables I get the following error:
An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT t0.MissionID AS MissionID_1, t0.Date AS Date_2, t0.Flighttime AS Flighttime_3, t0.PatientID AS PatientID_4, t0.Companion1 AS Companion1_5, t0.Companion2 AS Companion2_6, t0.Companion3 AS Companion3_7, t0.Companion4 AS Companion4_8, t0.Comments AS Comments_9, t0.AddChangeID AS AddChangeID_10, t0.AddChangeDate AS AddChangeDate_11, t0.Miles AS Miles_12 FROM leg t0 WHERE t0.MissionID = ?' with params [101]:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.Date' in 'field list'") in leg/list.html.twig at line 24.
The issue only occurs when I try to access anything from the Mission table. If I remove the line where I am trying to get the data from the mission table everything works fine. I use the same method for accessing data from other tables and I don't have any issues.
I'm at a loss as to why this is happening.
In my twig template I have the following:
<tbody>
{% for leg in legs %}
<tr>
<td>{{ leg.missionid.MissionID }}</td>
<td>{{ leg.legnumber }}</td>
<td>{{ leg.missionid.Date }}</td>
<td>{{ leg.originid.Identifier }}</td>
<td>{{ leg.destinationid.Identifier }}</td>
<td>{{ leg.legnumber }}</td>
<td>{{ leg.pilotid.PilotID }}</td>
</tr>...
My Entities are:
/**
* Mission
*
* @ORM\Table(name="leg")
* @ORM\Entity
*/
class Mission
{
/**
* @var integer
*
* @ORM\Column(name="MissionID", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $missionid;
/**
* @var \DateTime
*
* @ORM\Column(name="Date", type="datetime", nullable=true)
*/
private $date;
/**
* Leg
*
* @ORM\Table(name="leg", indexes={@ORM\Index(name="FK_MissionID", columns={"MissionID"}), @ORM\Index(name="FK_StatusID", columns={"StatusID"}), @ORM\Index(name="FK_PilotID", columns={"PilotID"}), @ORM\Index(name="FK_TypeID", columns={"TypeID"}), @ORM\Index(name="FK_OriginID", columns={"OriginID"}), @ORM\Index(name="FK_DestinationID", columns={"DestinationID"})})
* @ORM\Entity
*/
class Leg
{
/**
* @var integer
*
* @ORM\Column(name="LegID", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $legid;
...
/**
* @var \Location
*
* @ORM\ManyToOne(targetEntity="Location")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="DestinationID", referencedColumnName="LocationID")
* })
*/
private $destinationid;
/**
* @var \Mission
*
* @ORM\ManyToOne(targetEntity="Mission")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="MissionID", referencedColumnName="MissionID")
* })
*/
private $missionid;
/**
* @var \Location
*
* @ORM\ManyToOne(targetEntity="Location")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="OriginID", referencedColumnName="LocationID")
* })
*/
private $originid;
/**
* @var \Pilot
*
* @ORM\ManyToOne(targetEntity="Pilot")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="PilotID", referencedColumnName="PilotID")
* })
*/
private $pilotid;