예제 #1
0
 /**
  * @param ClassMetadata      $metadata
  * @param ReflectionProperty $property
  * @param ConfigAnnotation   $annotation
  */
 public function build(ClassMetadata $metadata, ReflectionProperty $property, ConfigAnnotation $annotation)
 {
     $builder = new AssociationBuilder(new ClassMetadataBuilder($metadata), ['fieldName' => $property->getName(), 'targetEntity' => $annotation->getTargetEntity($this->config)], ClassMetadata::MANY_TO_ONE);
     if (isset($annotation->inversedBy) && $annotation->inversedBy) {
         $builder->inversedBy($annotation->inversedBy);
     }
     $builder->build();
 }
예제 #2
0
 /**
  * @param ConfigAnnotation $annotation
  *
  * @return string
  */
 protected function getBuilder(ConfigAnnotation $annotation)
 {
     // If there's a target entity, create pivot table
     if ($annotation->getTargetEntity($this->config)) {
         return ManyToManyBuilder::class;
     }
     // Else save the permissions inside the table as json
     return JsonArrayBuilder::class;
 }