Пример #1
0
 /**
  * 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->originSqlType = $domain->getOriginSqlType();
     $this->mappingType = $domain->getType();
 }
Пример #2
0
 /**
  * Adds a domain object to this database.
  *
  * @param  Domain|array $data
  * @return Domain
  */
 public function addDomain($data)
 {
     if ($data instanceof Domain) {
         $domain = $data;
         // alias
         $domain->setDatabase($this);
         $this->domainMap[$domain->getName()] = $domain;
         return $domain;
     }
     $domain = new Domain();
     $domain->setDatabase($this);
     $domain->loadMapping($data);
     return $this->addDomain($domain);
     // call self w/ different param
 }
Пример #3
0
 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);
 }
Пример #4
0
 /**
  * Returns the default value suitable for use in PHP.
  *
  * @return mixed
  * @see Domain::getPhpDefaultValue()
  */
 public function getPhpDefaultValue()
 {
     return $this->domain->getPhpDefaultValue();
 }
 /**
  * Adds a mapping entry for specified Domain.
  * @param Domain $domain
  */
 protected function setSchemaDomainMapping(Domain $domain)
 {
     $this->schemaDomainMap[$domain->getType()] = $domain;
 }