mailpoet
/
vendor-prefixed
/
doctrine
/
orm
/
src
/
Mapping
/
Builder
/
OneToManyAssociationBuilder.php
AssociationBuilder.php
9 months ago
ClassMetadataBuilder.php
9 months ago
EmbeddedBuilder.php
9 months ago
EntityListenerBuilder.php
9 months ago
FieldBuilder.php
9 months ago
ManyToManyAssociationBuilder.php
9 months ago
OneToManyAssociationBuilder.php
9 months ago
index.php
9 months ago
OneToManyAssociationBuilder.php
28 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM\Mapping\Builder; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | class OneToManyAssociationBuilder extends AssociationBuilder |
| 6 | { |
| 7 | public function setOrderBy(array $fieldNames) |
| 8 | { |
| 9 | $this->mapping['orderBy'] = $fieldNames; |
| 10 | return $this; |
| 11 | } |
| 12 | public function setIndexBy($fieldName) |
| 13 | { |
| 14 | $this->mapping['indexBy'] = $fieldName; |
| 15 | return $this; |
| 16 | } |
| 17 | public function build() |
| 18 | { |
| 19 | $mapping = $this->mapping; |
| 20 | if ($this->joinColumns) { |
| 21 | $mapping['joinColumns'] = $this->joinColumns; |
| 22 | } |
| 23 | $cm = $this->builder->getClassMetadata(); |
| 24 | $cm->mapOneToMany($mapping); |
| 25 | return $this->builder; |
| 26 | } |
| 27 | } |
| 28 |