I do not know what relationship to use for this application: Many orders can have the same storage space, and one storage space can refer to many orders.I tried Many-To-Many, Unidirectional and One-To-Many, Bidirectional but using such a solution for another table e.g payment status.
I get the error
The mappings AppBundle \ Entity \ ... and AppBundle \ Entity \ ... are inconsistent with each other.
AFAIU you're trying to describe a one-to-many relationship: Order (*)-----(1) StorageSpace
If so, this is the piece of documentation you're looking for: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html#one-to-many-bidirectional
This will result in something like the following mapping :
/** @ORM\Entity */
class Order
{
//...
/** @ORM\ManyToOne(targetEntity="StorageSpace", inversedBy="orders") */
private $storageSpace;
}
/** @ORM\Entity */
class StorageSpace
{
//...
/** @ORM\OneToMany(targetEntity="Order", mappedBy="storageSpace") */
private $orders;
public function __construct()
{
$this->orders = new ArrayCollection;
}
}