public static function getRootfolderByModule($module) { $found = false; $searchModule = $module; if (strtolower($searchModule) == 'tag') { $searchModule = 'admin'; } $formFile = sfConfig::get('sf_root_dir') . "/config/form.xml"; if (is_readable($formFile)) { $objects = XMLParser::getXMLdataValues($formFile); foreach ($objects as $obj) { if ($obj['tag'] == 'OBJECT' && $obj['type'] == 'open') { if (strtoupper($obj['attributes']['MODULE']) == strtoupper($searchModule)) { $found = true; break; } } } } if (!$found) { //echo "getRootfolderByModule($module): not_found!"; return null; } try { $c = new Criteria(); $c->add(RootfolderPeer::LABEL, $module); $c->addOr(RootfolderPeer::LABEL, ucfirst($module)); $rootFolder = RootfolderPeer::doSelectOne($c); if (!$rootFolder) { $rootFolder = new Rootfolder(); $rootFolder->setLabel(ucfirst($module)); $rootFolder->save(); } return $rootFolder; } catch (Exception $e) { throw $e; } }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(RootfolderPeer::ID, $pks, Criteria::IN); $objs = RootfolderPeer::doSelect($criteria, $con); } return $objs; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RootfolderPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setLabel($arr[$keys[1]]); } }