Does anybody know how to select the contents of one take from a different view in CakePHP?
I have a take itemgroups that has 2 fields ID an
This is the right solution in my opinion:
of choices from column SET or ENUM type
*
* @param string $sColumn - col name
* @param string $sTable - if use other table as Model
* @return array
*/
function fGetArrayFromSQLSet($sColumn, $sTable=null) {
# Pokud neni urcena tabulka, pouzij tabulku modelu
if( !$sTable ) {
$sTable= $this->useTable;
}
# Nacti nastaveni daneho pole dane tabulky
$tmpHlaseno=$this->query("SELECT COLUMN_TYPE
FROM information_schema.columns
WHERE TABLE_NAME = '$sTable'
AND COLUMN_NAME = '$sColumn'
"); //db($tmpHlaseno);
$tmpList= $tmpHlaseno[0]['columns']['COLUMN_TYPE'];
# Ziskej hodnoty z nastaveni a uloz je do pole
$sTmp= str_replace(')', '', str_replace('set(', '', str_replace('enum(', '', $tmpList)));
$aTmp= explode(',', str_replace("'", '', $sTmp));
foreach( $aTmp as $value ) {
$aSetList[$value]= $value;
} //db($aSetList);
return $aSetList;
} // END of fGetArrayFromSQLSet