Exemplo n.º 1
0
 public static function getTypeByDoctrineType(Type $type)
 {
     $mapping = array_flip(self::$mapping);
     if (isset($mapping[$type->getName()])) {
         return $mapping[$type->getName()];
     } else {
         return TableInterface::TYPE_VARCHAR;
     }
 }
Exemplo n.º 2
0
 public function doctrineColumnLookup($col_lookup)
 {
     if (isset($this->options['expr']) && isset($col_lookup[$this->options['expr']])) {
         /**
          * @var $col Column
          */
         $col = $col_lookup[$this->options['expr']];
         $this->type = $col->getType();
         $this->typeName = self::simplifyTypeName($this->type->getName());
     }
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function setType(Type $type)
 {
     if ($this->constructed) {
         $this->setOptions([OroOptions::KEY => [ExtendOptionsManager::TYPE_OPTION => $type->getName()]]);
     }
     return parent::setType($type);
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function isCommentedDoctrineType(Type $doctrineType)
 {
     if ($doctrineType->getName() === Type::BOOLEAN) {
         // We require a commented boolean type in order to distinguish between boolean and smallint
         // as both (have to) map to the same native type.
         return true;
     }
     return parent::isCommentedDoctrineType($doctrineType);
 }
Exemplo n.º 5
0
 /**
  * Get the comment to append to a column comment that helps parsing this type in reverse engineering.
  *
  * @param Type $doctrineType
  * @return string
  */
 public function getDoctrineTypeComment(Type $doctrineType)
 {
     return '(DC2Type:' . $doctrineType->getName() . ')';
 }
 public function testGetName()
 {
     $this->assertEquals('str_uuid', $this->type->getName());
 }
Exemplo n.º 7
0
 private function value(EntityManager $em, Type $type, $value)
 {
     $platform = $em->getConnection()->getDatabasePlatform();
     switch ($type->getName()) {
         case Type::BOOLEAN:
             return $type->convertToPHPValue($value, $platform);
             // json supports boolean values
         // json supports boolean values
         default:
             return $type->convertToDatabaseValue($value, $platform);
     }
 }