function getSqlTypes() { if (!$this->sqlTypes) { $this->sqlTypes = array(); foreach ($this->entity->getLogicalSchema()->getProperties() as $property) { $fields = array_combine($property->getFields(), $property->getType()->getSqlTypes()); $this->sqlTypes = array_merge($this->sqlTypes, $fields); } } return $this->sqlTypes; }
/** * Create a php code which implements a setter within the entity class * @param IMappable $entity * @param OrmProperty $property */ function toSetter(IMappable $entity, OrmProperty $property) { $argCastType = ($argCastType = $this->getImplClass()) ? $argCastType . ' ' : ''; $argDocType = $argCastType ? $this->getImplClass() : 'scalar'; $defaultValue = $property->getMultiplicity()->isNullable() ? ' = null' : ''; $propertyName = $property->getName(); $capitalizedPropertyName = ucfirst($propertyName); return <<<EOT \t/** \t * @param {$argDocType} \${$propertyName} \t * @return {$entity->getLogicalSchema()->getEntityName()} itself \t */ \tfunction {$property->getSetter()}({$argCastType}\${$propertyName}{$defaultValue}) \t{ \t\t\$this->{$propertyName} = \${$propertyName}; \t\treturn \$this; \t} EOT; }