/** * {@inheritdoc} */ public function preUpdate() { $targetEntities = $this->getTargetEntities(); foreach ($targetEntities as $targetEntity) { $this->associationBuilder->createManyToOneAssociation('Oro\\Bundle\\TrackingBundle\\Entity\\TrackingVisit', $targetEntity, IdentifierEventExtension::ASSOCIATION_KIND); } }
/** * {@inheritdoc} */ public function preUpdate() { $targetEntityConfigs = $this->getTargetEntityConfigs(); foreach ($targetEntityConfigs as $targetEntityConfig) { $this->associationBuilder->createManyToManyAssociation(self::ENTITY_CLASS, $targetEntityConfig->getId()->getClassName(), self::ASSOCIATION_KIND); } }
/** * Creates the association between the given entities * * @param string $sourceEntityClass * @param string $targetEntityClass * * @throws \RuntimeException If the association cannot be created */ protected function createAssociation($sourceEntityClass, $targetEntityClass) { switch ($this->getAssociationType()) { case 'manyToOne': $this->associationBuilder->createManyToOneAssociation($sourceEntityClass, $targetEntityClass, $this->getAssociationKind()); break; case 'manyToMany': $this->associationBuilder->createManyToManyAssociation($sourceEntityClass, $targetEntityClass, $this->getAssociationKind()); break; default: throw new \RuntimeException(sprintf('The "%s" association is not supported.', $this->getAssociationType())); } }