/** * Actually processes a variable by consulting epManager * @param string $alias the starting alias for a variable * @param array $parts the array of attributes for the variable * @return false|array * @throws epExceptionQueryBuilder */ protected function _processVariable($node, $alias, $parts) { // get class name for alias if (!($class = $this->aliases[$alias])) { throw new epExceptionQueryBuilder($this->_e('Class for alias [' . $alias . '] not found', $node)); return false; } // get class map if (!($cm = $this->em->getMap($class))) { throw new epExceptionQueryBuilder($this->_e('Class [' . $class . '] not found', $node)); return false; } // go through each var $fms = array(); foreach ($parts as $part) { // make sure we have class map if (!$cm) { throw new epExceptionQueryBuilder($this->_e('Variable [' . $class . '::' . $part . '] not existing', $node)); return false; } // fake a fieldmap if part is 'oid' if ($part == 'oid') { $fm = new epFieldMapPrimitive('oid', epFieldMap::DT_INTEGER, array(), $cm); $fm->setColumnName($cm->getOidColumn()); } else { if (!($fm = $cm->getField($part))) { throw new epExceptionQueryBuilder($this->_e('Variable [' . $class . '::' . $part . '] not existing', $node)); return false; } } // collect this field map $fms[] = $fm; // must be a relationship field map $cm = null; if ($fm instanceof epFieldMapRelationship) { $cm = $this->em->getClassMap($fm->getClass()); $class = $cm->getName(); } } return $fms; }
/** * Implements magic method __wakeup() * Recovers cached manager and class map */ public function __wakeup() { // recover manager when waking up $this->ep_m = epManager::instance(); // recover class map $this->ep_cm = $this->ep_m->getMap(get_class($this->ep_object)); // cache this object in manager (important for flush) $this->ep_m->cache($this, true); // true: force replace }