2011-12-11 62 views
0

如何獲得在CakePHP中字段的枚舉值的字段的枚舉值2如何讓CakePHP的2

在1.3我可以很容易地與_schema array

+0

沒有運氣得到它我解? –

+0

還沒有嘗試過,我試過它會讓你知道 – aWebDeveloper

+0

做你的解決方案運行查詢 – aWebDeveloper

回答

4
// get column type 
$type = $this->Model->getColumnType('field'); 

// extract values in single quotes separated by comma 
preg_match_all("/'(.*?)'/", $type, $enums); 

// enums 
var_dump($enums[1]); 
+0

我與子字符b/w 6和-2,然後爆炸',' – aWebDeveloper

+0

偉大的東西,很高興它的工作。 –

+0

你想分享任何這種隱藏的寶石 – aWebDeveloper