protected function createAccessorMethod(PropertyDefinition $property)
 {
     $accessorPrefix = $property->getSourceConfiguration()['accessorPrefix'];
     $methodName = new PhpVariableName($accessorPrefix . $property->getName()->toUpperCamelCase());
     $method = new MethodDefinition($methodName);
     $method->setVisibility(Visibility::PUBLIC_VISIBILITY())->setReturnValue('$this->' . $property->getName()->toLowerCamelCase());
     return $method;
 }
 /**
  * @param array $configuration
  * @param PropertyDefinition $property
  * @return Cardinality
  */
 protected function getCardinality(array $configuration, PropertyDefinition $property)
 {
     $definition = $property->getSourceConfiguration();
     if (true === array_key_exists('inverse', $definition)) {
         //Get from inversed side
         $inversedConfiguration = $configuration['entities'][$definition['entity']];
         $inversedProperty = $inversedConfiguration['properties'][$definition['inverse']];
         //reverse Cardinality
         $cardinalityString = $inversedProperty['cardinality'];
         $source = substr($cardinalityString, 0, 1);
         $target = substr($cardinalityString, 2, 1);
         return new Cardinality($target . '.' . $source);
     } else {
         return new Cardinality($definition['cardinality']);
     }
 }
 /**
  * @param $entity
  * @param PropertyDefinition $property
  * @param Cardinality $cardinality
  * @return array
  */
 private function generateJoinColumn($entity, PropertyDefinition $property, Cardinality $cardinality)
 {
     $joinColumns = [];
     $definition = $property->getSourceConfiguration();
     $nullable = 0 === substr($cardinality, 2, 1) || true === $definition['nullable'];
     foreach ($this->getPrimaryProperties($this->configuration, $entity) as $primary) {
         $joinColumn = ['name' => '"' . $property->getName()->toLowerSnakeCase() . '_' . $primary->toLowerSnakeCase() . '"'];
         if ('id' !== $primary->toLowerCamelCase()) {
             $joinColumn['referencedColumnName'] = '"' . $primary->toLowerSnakeCase() . '"';
         }
         if (true === $nullable) {
             $joinColumn['nullable'] = 'true';
         }
         if (true === $definition['unique']) {
             $joinColumn['unique'] = 'true';
         }
         $formattedConf = [];
         foreach ($joinColumn as $key => $value) {
             $formattedConf[] = sprintf('%s=%s', $key, $value);
         }
         $joinColumns[] = sprintf('@ORM\\JoinColumn(%s)', implode(', ', $formattedConf));
     }
     return $joinColumns;
 }