public function isDefaultSqlType(PlatformInterface $platform = null) { if (null === $this->domain || null === $this->domain->getSqlType() || null === $platform) { return true; } $defaultSqlType = $platform->getDomainForType($this->getType())->getSqlType(); return $defaultSqlType === $this->getDomain()->getSqlType(); }
/** * Copies the values from current object into passed-in Domain. * * @param Domain $domain Domain to copy values into. */ public function copy(Domain $domain) { $this->defaultValue = $domain->getDefaultValue(); $this->description = $domain->getDescription(); $this->name = $domain->getName(); $this->scale = $domain->getScale(); $this->size = $domain->getSize(); $this->sqlType = $domain->getSqlType(); $this->mappingType = $domain->getType(); }
public function testCopyDomain() { $value = $this->getColumnDefaultValueMock(); $domain = new Domain(); $domain->setType('FLOAT'); $domain->setSqlType('DOUBLE'); $domain->setSize(10); $domain->setScale(2); $domain->setName('Mapping between FLOAT and DOUBLE'); $domain->setDescription('Some description'); $domain->setDefaultValue($value); $newDomain = new Domain(); $newDomain->copy($domain); $this->assertSame('FLOAT', $newDomain->getType()); $this->assertSame('DOUBLE', $newDomain->getSqlType()); $this->assertSame(10, $newDomain->getSize()); $this->assertSame(2, $newDomain->getScale()); $this->assertSame('Mapping between FLOAT and DOUBLE', $newDomain->getName()); $this->assertSame('Some description', $newDomain->getDescription()); $this->assertInstanceOf('Propel\\Generator\\Model\\ColumnDefaultValue', $value); }