| 1 | <?php |
||
| 7 | trait ManyTo |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var JoinColumn[] |
||
| 11 | */ |
||
| 12 | protected $joinColumns = []; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Build the association |
||
| 16 | */ |
||
| 17 | 68 | public function build() |
|
| 18 | { |
||
| 19 | 68 | foreach ($this->getJoinColumns() as $column) { |
|
| 20 | 43 | $this->getAssociation()->addJoinColumn( |
|
| 21 | 43 | $column->getJoinColumn(), |
|
| 22 | 43 | $column->getReferenceColumn(), |
|
| 23 | 43 | $column->isNullable(), |
|
| 24 | 43 | $column->isUnique(), |
|
| 25 | 43 | $column->getOnDelete() |
|
| 26 | 43 | ); |
|
| 27 | 68 | } |
|
| 28 | |||
| 29 | 68 | parent::build(); |
|
| 30 | 67 | } |
|
| 31 | |||
| 32 | /** |
||
| 33 | * @param string $relation |
||
| 34 | * @param string|null $joinColumn |
||
| 35 | * @param string|null $referenceColumn |
||
| 36 | * @param bool|false $nullable |
||
| 37 | * @param bool|false $unique |
||
| 38 | * @param string|null $onDelete |
||
| 39 | * |
||
| 40 | * @return $this |
||
| 41 | */ |
||
| 42 | 55 | public function addJoinColumn( |
|
| 64 | |||
| 65 | /** |
||
| 66 | * @param JoinColumn $column |
||
| 67 | */ |
||
| 68 | 55 | protected function pushJoinColumn(JoinColumn $column) |
|
| 72 | |||
| 73 | /** |
||
| 74 | * @return JoinColumn[] |
||
| 75 | */ |
||
| 76 | 70 | public function getJoinColumns() |
|
| 80 | |||
| 81 | /** |
||
| 82 | * @return \Doctrine\ORM\Mapping\Builder\AssociationBuilder |
||
| 83 | */ |
||
| 84 | abstract public function getAssociation(); |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @return \Doctrine\ORM\Mapping\NamingStrategy |
||
| 88 | */ |
||
| 89 | abstract public function getNamingStrategy(); |
||
| 90 | } |
||
| 91 |