function toDialectString(IDialect $dialect)
 {
     return $this->getHead($dialect) . ' FOREIGN KEY (' . $this->fields->toDialectString($dialect) . ')' . ' REFERENCES ' . $dialect->quoteIdentifier($this->referencedTable->getName()) . '(' . $this->pkFields->toDialectString($dialect) . ')' . ' ON DELETE ' . $this->associationBreakAction->toDialectString($dialect) . ' ON UPDATE ' . AssociationBreakAction::cascade()->toDialectString($dialect);
 }
 /**
  * Resolution order:
  *  - IDaoRelated (check a class existance within the global scope and withing the domain scope) --> AssociationPropertyType
  *  - IOrmRelated --> CompositionPropertyType
  *  - IOrmPropertyAssignable --> IOrmPropertyAssignable::getOrmProperty()
  *  - IBoxable --> BoxablePropertyType
  *  - DBType
  *  - any type with public ctor
  * @return OrmPropertyType
  */
 private function getPropertyType(SimpleXMLElement $element, AssociationMultiplicity $multiplicity)
 {
     $name = (string) $element['type'];
     $parameters = $this->getTypeParameters($element);
     if ($class = $this->importEntity($name)) {
         // force recursion
         if ($class->hasDao() && $class->getIdentifier()) {
             return new AssociationPropertyType($class, $multiplicity, AssociationBreakAction::cascade());
         } else {
             return new CompositePropertyType($class);
         }
     } else {
         if (DBType::hasMember($name)) {
             $parameters['id'] = $name;
             if (!isset($parameters['nullable'])) {
                 $parameters['nullable'] = $multiplicity->isNullable() ? 'true' : 'false';
             }
             $dbType = $this->makeObject('DBType', $parameters);
             return $dbType->getOrmPropertyType();
         } else {
             if (@class_exists($name, true)) {
                 if (TypeUtils::isInherits($name, 'IDaoRelated')) {
                     return new AssociationPropertyType(call_user_func(array($name, 'orm')), $multiplicity, AssociationBreakAction::cascade());
                 } else {
                     if (TypeUtils::isInherits($name, 'IOrmRelated')) {
                         $orm = call_user_func(array($name, 'orm'));
                         return new CompositePropertyType($orm);
                     } else {
                         if (TypeUtils::isInherits($name, 'IOrmPropertyAssignable')) {
                             return call_user_func(array($name, 'getOrmPropertyType'), $multiplicity);
                         } else {
                             if (TypeUtils::isInherits($name, 'IBoxable')) {
                                 $parameters['id'] = DBType::VARCHAR;
                                 if (!isset($parameters['nullable'])) {
                                     $parameters['nullable'] = $multiplicity->isNullable() ? 'true' : 'false';
                                 }
                                 return new BoxablePropertyType($name, $this->makeObject('DBType', $parameters));
                             } else {
                                 if (TypeUtils::isInherits($name, 'ISqlType')) {
                                     // for RawSqlType
                                     return new PrimitivePropertyType($this->makeObject($name, $parameters));
                                 } else {
                                     if (TypeUtils::isInherits($name, 'OrmPropertyType')) {
                                         // OrmPropertyType with public ctor
                                         return $this->makeObject($name, $parameters);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     throw new OrmModelIntegrityException('Unknown type of ' . (string) $element['name'] . ' property:  ' . $name);
 }
 protected function getCtorArgumentsPhpCode()
 {
     return array($this->container->getLogicalSchema()->getEntityName() . '::orm()', 'new AssociationMultiplicity(AssociationMultiplicity::' . $this->multiplicity->getId() . ')', 'new AssociationBreakAction(AssociationBreakAction::' . $this->action->getId() . ')');
 }
 /**
  * Resolution order:
  *  - IDaoRelated (check a class existance within the global scope and withing the domain scope) --> AssociationPropertyType
  *  - IOrmRelated --> CompositionPropertyType (not implemented)
  *  - IOrmPropertyAssignable --> IOrmPropertyAssignable::getOrmProperty()
  *  - IBoxable --> BoxablePropertyType
  *  - DBType
  *  - any type with public ctor
  * @return OrmPropertyType
  */
 private function getPropertyType($name, AssociationMultiplicity $multiplicity, array $parameters = array())
 {
     if ($this->ormDomain->classExists($name)) {
         $class = $this->ormDomain->getClass($name);
         if ($class->hasDao() && $class->getIdentifier()) {
             return new AssociationPropertyType($class, $multiplicity, AssociationBreakAction::cascade());
         } else {
             return new CompositePropertyType($class);
         }
     } else {
         if (DBType::hasMember($name)) {
             $parameters['id'] = $name;
             if (!isset($parameters['nullable'])) {
                 $parameters['nullable'] = $multiplicity->isNullable() ? 'true' : 'false';
             }
             $dbType = $this->makeObject('DBType', $parameters);
             return $dbType->getOrmPropertyType();
         } else {
             if (class_exists($name, true)) {
                 if (TypeUtils::isChild($name, 'IDaoRelated')) {
                     return new AssociationPropertyType(call_user_func(array($name, 'orm')), $multiplicity, AssociationBreakAction::cascade());
                 } else {
                     if (TypeUtils::isChild($name, 'IOrmRelated')) {
                         $orm = call_user_func(array($name, 'orm'));
                         return new CompositePropertyType($orm);
                     } else {
                         if (TypeUtils::isChild($name, 'IOrmPropertyAssignable')) {
                             return call_user_func(array($name, 'getOrmPropertyType'), $multiplicity);
                         } else {
                             if (TypeUtils::isChild($name, 'IBoxable')) {
                                 $parameters['id'] = DBType::VARCHAR;
                                 if (!isset($parameters['nullable'])) {
                                     $parameters['nullable'] = $multiplicity->isNullable() ? 'true' : 'false';
                                 }
                                 return new BoxablePropertyType($name, $this->makeObject('DBType', $parameters));
                             } else {
                                 if (TypeUtils::isChild($name, 'ISqlType')) {
                                     // for RawSqlType
                                     return new PrimitivePropertyType($this->makeObject($name, $parameters));
                                 } else {
                                     //$this->makeObject($name, $parameters);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     throw new OrmModelIntegrityException('do not know how to map ' . $name);
 }