function generate(IdentifiableOrmEntity $entity)
 {
     $value = $this->generator->generate($entity);
     if (!is_null($value)) {
         $value = $this->type->assemble(array($value), new FetchStrategy(FetchStrategy::CASCADE));
     }
     return $value;
 }
 /**
  * @return string
  */
 function toPhpCall()
 {
     $fields = array();
     foreach ($this->fields as $field) {
         $fields[] = '\'' . $field . '\'';
     }
     $ctorArguments = array("'{$this->name}'", 'array(' . join(', ', $fields) . ')', $this->type->toPhpCodeCall(), "new OrmPropertyVisibility(OrmPropertyVisibility::{$this->visibility->getId()})", "new AssociationMultiplicity(AssociationMultiplicity::{$this->multiplicity->getId()})", $this->isUnique ? 'true' : 'false', $this->isIdentifier ? 'true' : 'false');
     return join('', array('new OrmProperty(', join(', ', $ctorArguments), ')'));
 }
 function getColumnCount()
 {
     return $this->fkType->getColumnCount();
 }
 private function makeFields($propertyName, OrmPropertyType $ormPropertyTpe)
 {
     $fields = array();
     $propertyPrefix = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $propertyName));
     foreach (array_keys($ormPropertyTpe->getSqlTypes()) as $key) {
         $fields[] = $propertyPrefix . (!is_int($key) || $key > 0 ? '_' . $key : '');
     }
     return $fields;
 }