packages/sql-fixture/src/Plan/RelationSide.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlFixture\Plan;
6
7/**
8 * Which end of a written relation is meant, before roles are worked out.
9 *
10 * `order.id < order_detail.order_id` and `order_detail.order_id > order.id`
11 * describe the same relation with the sides swapped, so parent and child are
12 * derived from the operator rather than from the order they were written in.
13 */
14enum RelationSide
15{
16 case Left;
17 case Right;
18
19 /**
20 * Returns opposite.
21 */
22 public function opposite(): self
23 {
24 return $this === self::Left ? self::Right : self::Left;
25 }
26}
27