I'm working with database with a lot of columns with 'enum' and 'set' type. My point is to get values of column in Phalcon controller. I found some snippets, but nothing in Phalcon and when I tried to execute them it seems that Phalcon have some problems.
public function getEnumValues(){
$sql = "SHOW COLUMNS FROM profiles LIKE 'eyes_color'";
$query = new \Phalcon\Mvc\Model\Query($sql, $this->getDI());
$result = $query->execute();
return $result;
}
Returns:
Syntax error, unexpected token IDENTIFIER(SHOW), near to ' COLUMNS FROM profiles LIKE 'eyes_color'', when parsing: SHOW COLUMNS FROM profiles LIKE 'eyes_color'
Approach 2:
public function getEnumValues(){
$sql = "SELECT COLUMN_TYPE FROM COLUMNS WHERE TABLE_NAME = 'profiles' AND COLUMN_NAME = 'hair_color'";
$query = new \Phalcon\Mvc\Model\Query($sql, $this->getDI());
$result = $query->execute();
return $result;
}
Returns:
Model 'COLUMNS' could not be loaded
I would be grateful for any help.