public function testHasFieldHandler()
 {
     $result = $this->fhf->hasFieldHandler('string');
     $this->assertTrue($result, "Failed to find field handler for type 'string'");
     $result = $this->fhf->hasFieldHandler('non-existing-field-type');
     $this->assertFalse($result, "Found field handler for type 'non-existing-field-type'");
 }
 /**
  * Check if the field type is valid
  *
  * Migration field type needs a field handler.
  *
  * @param string $type Field type
  * @return bool True if valid, false otherwise
  */
 protected function _isValidFieldType($type)
 {
     $result = false;
     $fhf = new FieldHandlerFactory();
     if ($fhf->hasFieldHandler($type)) {
         $result = true;
     }
     return $result;
 }
예제 #3
0
 /**
  * Field type setter.
  *
  * @param string $type field type
  * @return void
  */
 public function setType($type)
 {
     if (empty($type)) {
         throw new InvalidArgumentException(__CLASS__ . ': Empty field type is not allowed: ' . $this->getName());
     }
     $type = $this->_extractType($type);
     $fhf = new FieldHandlerFactory();
     if (!$fhf->hasFieldHandler($type)) {
         throw new InvalidArgumentException(__CLASS__ . ': Unsupported field type: ' . $type);
     }
     $this->_type = $type;
 }