Doctrine Terms

I am working on a Symfony2 project with an existing database.

There are different statuses in the database, where each status has a type. for instance

status  |  type  |  description
   C         O       Completed
   C         G       Cancelled

Now I have an order entity that combines with status. I only want to join orders where the status type is O.

My current model is as follows:

/**
 * @ORM\ManyToOne(targetEntity="Statuses", inversedBy="orders")
 * @ORM\JoinColumn(name="status", referencedColumnName="status")
 */
private $status;

How can I specify to join only to the type, so if the order has received the status C, then I get the "completed" status in the connection, and not the "canceled"?

Unfortunately, I cannot make any changes to the structure of the database, as there are other applications that depend on the structure.

+3
source share

All Articles