/** * Toggles the token type of data types between EPL_T_DATA_TYPE * and EPL_T_IDENTIFIER. This is to allow data types to be * used for class names. */ public function toggleDataTypeTokens() { // get data types (including 'has' and 'composed_of') $dtypes = epFieldMap::getSupportedTypes(); // go through all keywords foreach ($this->keywords as $keyword => $token) { if (!in_array($keyword, $dtypes)) { continue; } // has if ($keyword == epFieldMap::DT_HAS) { $this->keywords[$keyword] = $token == EPL_T_HAS ? EPL_T_IDENTIFIER : EPL_T_HAS; continue; } // composed of if ($keyword == epFieldMap::DT_COMPOSED_OF) { $this->keywords[$keyword] = $token == EPL_T_COMPOSED_OF ? EPL_T_IDENTIFIER : EPL_T_COMPOSED_OF; continue; } // primitive types $this->keywords[$keyword] = $token == EPL_T_DATA_TYPE ? EPL_T_IDENTIFIER : EPL_T_DATA_TYPE; } }
/** * Test var orm tag */ function testVarPrimTag() { // get all supported column types include_once EP_SRC_ORM . '/epFieldMap.php'; $alltypes = epFieldMap::getSupportedTypes(); $keytypes = array('', 'unique', 'index'); $keynames = array('', 'testingname'); foreach ($alltypes as $type) { // skip relationship types if ($type == epFieldMap::DT_HAS || $type == epFieldMap::DT_COMPOSED_OF) { continue; } $name = '_' . md5($type); $params = array(); if ($type == epFieldMap::DT_CHAR || $type == epFieldMap::DT_TEXT || $type == epFieldMap::DT_BLOB) { $params[] = rand(1, self::MAX_REPEATS); } elseif ($type == epFieldMap::DT_DECIMAL) { $params[] = rand(1, self::MAX_REPEATS); $params[] = rand(1, self::MAX_REPEATS); } foreach ($keytypes as $keytype) { foreach ($keynames as $keyname) { // skip the situations where we have no keytype but we have a keyname if ($keytype == '' && $keyname != '') { continue; } $this->_varPrimTag($name, $type, $params, $keytype, $keyname); } } } }
/** * Constructor * @param string tag value */ public function __construct($value) { // make match pattern of all supported types if (!self::$alltypes) { include_once EP_SRC_ORM . '/epFieldMap.php'; self::$alltypes = epFieldMap::getSupportedTypes(); } parent::__construct($value); }