. */ namespace Doctrine\ORM\Mapping\Builder; /** * OneToMany Association Builder * * @license http://www.opensource.org/licenses/mit-license.php MIT * @link www.doctrine-project.com * @since 2.0 * @author Benjamin Eberlei */ class OneToManyAssociationBuilder extends AssociationBuilder { /** * @param array $fieldNames * * @return OneToManyAssociationBuilder */ public function setOrderBy(array $fieldNames) { $this->mapping['orderBy'] = $fieldNames; return $this; } /** * @param string $fieldName * * @return OneToManyAssociationBuilder */ public function setIndexBy($fieldName) { $this->mapping['indexBy'] = $fieldName; return $this; } /** * @return ClassMetadataBuilder */ public function build() { $mapping = $this->mapping; if ($this->joinColumns) { $mapping['joinColumns'] = $this->joinColumns; } $cm = $this->builder->getClassMetadata(); $cm->mapOneToMany($mapping); return $this->builder; } }