我想在startdate接近时显示一条约会的欢迎消息(该函数是用js构建的)。 现在对于视图:消息中的数据来自与使用连接列相关的另一个实体。现在我无法通过约会循环,因为这将显示所有约会的消息,无论startdate是什么。
这是我的预约实体
/**
* @ORM\Entity
* @ORM\Table(name="appointments")
* @ORM\Entity(repositoryClass="AppBundle\Repository\AppointmentRepository") */
class Appointment
{
/**
* @ORM\ManyToOne(targetEntity="Client")
* @ORM\JoinColumn(name="client_id", referencedColumnName="id")
*/
protected $client;
/**
* @ORM\ManyToMany(targetEntity="ClientEmployee")
* @ORM\JoinTable(name="appointment_clientemployee",
* joinColumns={@ORM\JoinColumn(name="appointment_id", referencedColumnName="id", onDelete="cascade")},
* inverseJoinColumns={@ORM\JoinColumn(name="clientempoloyee_id", referencedColumnName="id", onDelete="cascade")}
* )
*/
protected $clientEmployees;
这是我的客户实体
/**
* @ORM\Entity
* @ORM\Table(name="client")
* @ORM\HasLifecycleCallbacks
*/
class Client
{
/**
* @ORM\ManyToMany(targetEntity="ClientEmployee", cascade={"remove", "persist"})
* @ORM\JoinTable(name="client_client_employee",
* joinColumns={@ORM\JoinColumn(name="client_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="client_employee_id", referencedColumnName="id", unique=true, onDelete="cascade")}
* )
*/
protected $clientEmployees;
/**
* @ORM\Column(name="path", type="string", length=255, nullable=true)
*/
private $path;
这是HTML(我正在使用twig模板)
<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>