isRelationshipEntity() public method

public isRelationshipEntity ( ) : boolean
return boolean
 public function __construct(EntityManager $em, $baseEntity, $targetEntityClass, RelationshipMetadata $relationshipMetadata, $initialEntity = null)
 {
     $this->finder = $relationshipMetadata->isRelationshipEntity() ? new RelationshipEntityFinder($em, $targetEntityClass, $relationshipMetadata, $baseEntity) : new RelationshipsFinder($em, $targetEntityClass, $relationshipMetadata);
     $this->em = $em;
     $this->collection = new Collection();
     $this->baseId = $this->em->getClassMetadataFor(get_class($baseEntity))->getIdValue($baseEntity);
     $this->initialEntity = $initialEntity;
     $this->baseEntityClass = get_class($baseEntity);
     $this->relationshipMetadata = $relationshipMetadata;
     $this->baseInstance = $baseEntity;
 }
Exemplo n.º 2
0
 public function persistRelationship($entityA, $entityB, RelationshipMetadata $relationship, array &$visited)
 {
     if ($entityB instanceof Collection || $entityB instanceof ArrayCollection) {
         foreach ($entityB as $e) {
             $aMeta = $this->entityManager->getClassMetadataFor(get_class($entityA));
             $bMeta = $this->entityManager->getClassMetadataFor(get_class($entityB));
             $type = $relationship->isRelationshipEntity() ? $this->entityManager->getRelationshipEntityMetadata($relationship->getRelationshipEntityClass())->getType() : $relationship->getType();
             $hashStr = $aMeta->getIdValue($entityA) . $bMeta->getIdValue($entityB) . $type . $relationship->getDirection();
             $hash = md5($hashStr);
             if (!array_key_exists($hash, $this->relationshipsScheduledForCreated)) {
                 $this->relationshipsScheduledForCreated[] = [$entityA, $relationship, $e, $relationship->getPropertyName()];
             }
             $this->doPersist($e, $visited);
         }
         return;
     }
     $this->doPersist($entityB, $visited);
     $this->relationshipsScheduledForCreated[] = [$entityA, $relationship, $entityB, $relationship->getPropertyName()];
 }