/**
  * Retrieve flat columns DDL definition
  *
  * @return array
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function _getFlatColumnsDdlDefinition()
 {
     $columns = [];
     switch ($this->getBackendType()) {
         case 'static':
             $describe = $this->_getResource()->describeTable($this->getBackend()->getTable());
             if (!isset($describe[$this->getAttributeCode()])) {
                 break;
             }
             $prop = $describe[$this->getAttributeCode()];
             $type = $prop['DATA_TYPE'];
             $size = $prop['LENGTH'] ? $prop['LENGTH'] : null;
             $columns[$this->getAttributeCode()] = ['type' => $this->_resourceHelper->getDdlTypeByColumnType($type), 'length' => $size, 'unsigned' => $prop['UNSIGNED'] ? true : false, 'nullable' => $prop['NULLABLE'], 'default' => $prop['DEFAULT'], 'extra' => null];
             break;
         case 'datetime':
             $columns[$this->getAttributeCode()] = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, 'unsigned' => false, 'nullable' => true, 'default' => null, 'extra' => null];
             break;
         case 'decimal':
             $columns[$this->getAttributeCode()] = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'unsigned' => false, 'nullable' => true, 'default' => null, 'extra' => null];
             break;
         case 'int':
             $columns[$this->getAttributeCode()] = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'unsigned' => false, 'nullable' => true, 'default' => null, 'extra' => null];
             break;
         case 'text':
             $columns[$this->getAttributeCode()] = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'unsigned' => false, 'nullable' => true, 'default' => null, 'extra' => null, 'length' => \Magento\Framework\DB\Ddl\Table::MAX_TEXT_SIZE];
             break;
         case 'varchar':
             $columns[$this->getAttributeCode()] = ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => '255', 'unsigned' => false, 'nullable' => true, 'default' => null, 'extra' => null];
             break;
         default:
             break;
     }
     return $columns;
 }
Exemplo n.º 2
0
 /**
  * Retrieve flat column definition
  *
  * @return array
  */
 public function getFlatColums()
 {
     $attributeType = $this->getAttribute()->getBackendType();
     $attributeCode = $this->getAttribute()->getAttributeCode();
     $column = array('unsigned' => false, 'default' => null, 'extra' => null);
     $column['type'] = $this->_eavResourceHelper->getDdlTypeByColumnType($attributeType);
     $column['nullable'] = true;
     return array($attributeCode => $column);
 }
Exemplo n.º 3
0
 /**
  * Retrieve flat column definition
  *
  * @return array
  */
 public function getFlatColumns()
 {
     $attributeType = $this->getAttribute()->getBackendType();
     $attributeCode = $this->getAttribute()->getAttributeCode();
     return [$attributeCode => ['unsigned' => false, 'default' => null, 'extra' => null, 'type' => $this->_eavResourceHelper->getDdlTypeByColumnType($attributeType), 'nullable' => true]];
 }