I want to display a welcome message for an appointment when the startdate is near (the function is built with js). Now for the view: The data that is in the message comes from another entity which is related to by use of a join-column. Now i cant use a loop through the appointments because this wil show the message for all the appointments regardless of what the startdate is.
this is is my appointment entity
/**
* @ORMEntity
* @ORMTable(name="appointments")
* @ORMEntity(repositoryClass="AppBundleRepositoryAppointmentRepository") */
class Appointment
{
/**
* @ORMManyToOne(targetEntity="Client")
* @ORMJoinColumn(name="client_id", referencedColumnName="id")
*/
protected $client;
/**
* @ORMManyToMany(targetEntity="ClientEmployee")
* @ORMJoinTable(name="appointment_clientemployee",
* joinColumns={@ORMJoinColumn(name="appointment_id", referencedColumnName="id", onDelete="cascade")},
* inverseJoinColumns={@ORMJoinColumn(name="clientempoloyee_id", referencedColumnName="id", onDelete="cascade")}
* )
*/
protected $clientEmployees;
This is my client entity
/**
* @ORMEntity
* @ORMTable(name="client")
* @ORMHasLifecycleCallbacks
*/
class Client
{
/**
* @ORMManyToMany(targetEntity="ClientEmployee", cascade={"remove", "persist"})
* @ORMJoinTable(name="client_client_employee",
* joinColumns={@ORMJoinColumn(name="client_id", referencedColumnName="id")},
* inverseJoinColumns={@ORMJoinColumn(name="client_employee_id", referencedColumnName="id", unique=true, onDelete="cascade")}
* )
*/
protected $clientEmployees;
/**
* @ORMColumn(name="path", type="string", length=255, nullable=true)
*/
private $path;
This is the HTML(im using twig templating)
<div class="message-overlay">
<div class="message-box">
<p>Van harte welkom</p><br>
<p> {{ appointment.client_client_employee.firstname }}</p>
<div class="greeting-box" style="background-image: url({{ asset('bundles/app/img/dots-repeat.png') }});">
<img class="message-embleem" src="{{ asset('bundles/app/img/Lameco_Icon_1.png') }}"/>
</div>
<div class="image-box">
{#<img src="{{ asset('/../../../../web/' ~ client.path) }}"/>#}
</div>
</div>
</div>
