Menu

Cannot process definition to array for type tinytext on Magento 2

1. Problem

getting error "Cannot process definition to array for type tinytext" when upgrade magento 2

2. How to fix

  1. Open file:
    /vendor/magento/framework/Setup/Declaration/Schema/Db/DefinitionAggregator.php
  2. Replace function fromDefinition:
    			
    			
    public function fromDefinition(array $data)
    {
    	
    	$type = $data['type'];
    	
    	if(in_array($type, ["tinytext", "enum"])){
    		$data['type'] = 'text';
    		$type = 'text';
    	}
    	
    	if(in_array($type, ['time', 'mediumint'])){
    		$data['type'] = 'datetime';
    		$type = 'datetime';
    	}
    	
    	if(in_array($type, ['mediumint'])){
    		$data['type'] = 'int';
    		$type = 'int';
    	}
    	
    	if (!isset($this->definitionProcessors[$type])) {
    		throw new \InvalidArgumentException(
    			sprintf("Cannot process definition to array for type %s", $type)
    		);
    	}
    
    	$definitionProcessor = $this->definitionProcessors[$type];
    	return $definitionProcessor->fromDefinition($data);
    }			
    			
    		

Are you want hire us for your project? Please contact us, we will quote for you.