예제 #1
0
 /**
  * @param ClassMetadata      $metadata
  * @param ReflectionProperty $property
  * @param ConfigAnnotation   $annotation
  */
 public function build(ClassMetadata $metadata, ReflectionProperty $property, ConfigAnnotation $annotation)
 {
     $builder = new ManyToManyAssociationBuilder(new ClassMetadataBuilder($metadata), ['fieldName' => $property->getName(), 'targetEntity' => $annotation->getTargetEntity($this->config)], ClassMetadata::MANY_TO_MANY);
     if (isset($annotation->inversedBy) && $annotation->inversedBy) {
         $builder->inversedBy($annotation->inversedBy);
     }
     if (isset($annotation->mappedBy) && $annotation->mappedBy) {
         $builder->mappedBy($annotation->mappedBy);
     }
     $builder->build();
 }
예제 #2
0
 /**
  * @param string $inverseKey
  * @param string $references
  * @param bool   $unique
  *
  * @return $this
  */
 public function inverseKey($inverseKey, $references = 'id', $unique = false)
 {
     $this->association->addInverseJoinColumn($inverseKey, $references, false, $unique);
     return $this;
 }