public function executeApprove() { $approval = sfApprovalPeer::retrieveByUuid($this->getRequestParameter('uuid')); if (!$approval) { return 'NotFound'; } $object = $approval->getRelatedObject(); $this->setFlash('sf_approvable_object', $object); $class = get_class($object); $peerClass = get_class($object->getPeer()); $destination = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . $class . '_destination', '@homepage'); $approvedValue = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . $class . '_approved_value', true); $columnName = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . $class . '_column', 'is_approved'); $method = 'set' . call_user_func(array($peerClass, 'translateFieldName'), $columnName, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_PHPNAME); $ret = null; foreach (sfMixer::getCallables('sfApprovableActions:approve:pre') as $callable) { $ret = call_user_func($callable, $object); } if (!is_null($ret)) { return $ret; } $object->{$method}($approvedValue); $object->save(); $approval->delete(); foreach (sfMixer::getCallables('sfApprovableActions:approve:post') as $callable) { $ret = call_user_func($callable, $object); } if (!is_null($ret)) { return $ret; } $this->redirect($destination); }
/** * * @param $sfGuardUser * @param $facebook_uid * @return unknown_type * @author fabriceb * @since Sep 1, 2009 */ public static function newSfGuardConnectionHook($sfGuardUser, $facebook_uid) { if (class_exists('sfEvent')) { sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($sfGuardUser, 'sf_guard.user.facebook.create', array('facebook_uid' => $facebook_uid))); } else { foreach (sfMixer::getCallables('sfFacebookConnect:newSfGuardConnection:preSave') as $callable) { call_user_func($callable, &$sfGuardUser, $facebook_uid); } } }
/** * Saves a comment, for a non authentified user */ public function executeAnonymousComment() { $this->getConfig(); if ($this->config_anonymous['enabled'] && $this->getRequest()->getMethod() == sfRequest::POST) { $token = $this->getRequestParameter('sf_comment_object_token'); $object = sfPropelActAsCommentableToolkit::retrieveFromToken($token); $namespace = $this->getRequestParameter('sf_comment_namespace', null); $this->namespace = $namespace; $this->validateNamespace($namespace); $comment = array('title' => $this->getRequestParameter('sf_comment_title'), 'text' => $this->getRequestParameter('sf_comment'), 'author_name' => $this->getRequestParameter('sf_comment_name'), 'author_email' => $this->getRequestParameter('sf_comment_email'), 'namespace' => $namespace); foreach (sfMixer::getCallables('sfCommentActions:addComment:pre') as $callable) { call_user_func($callable, $comment, $object); } $comment_object = $object->addComment($comment); foreach (sfMixer::getCallables('sfCommentActions:addComment:post') as $callable) { call_user_func($callable, $comment_object, $object); } $this->object = $object; if (!$this->getContext()->getRequest()->isXmlHttpRequest()) { $this->redirect($this->getRequestParameter('sf_comment_referer')); } } $this->setTemplate('comment'); }
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) { // we may modify criteria, so copy it first $criteria = clone $criteria; // We need to set the primary table name, since in the case that there are no WHERE columns // it will be impossible for the BasePeer::createSelectSql() method to determine which // tables go into the FROM clause. $criteria->setPrimaryTableName(FormularioPeer::TABLE_NAME); if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->setDistinct(); } if (!$criteria->hasSelectClause()) { FormularioPeer::addSelectColumns($criteria); } $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName if ($con === null) { $con = Propel::getConnection(FormularioPeer::DATABASE_NAME, Propel::CONNECTION_READ); } foreach (sfMixer::getCallables('BaseFormularioPeer:doCount:doCount') as $callable) { call_user_func($callable, 'BaseFormularioPeer', $criteria, $con); } $criteria = self::kriterio($criteria); // BasePeer returns a PDOStatement $stmt = BasePeer::doCount($criteria, $con); if ($row = $stmt->fetch(PDO::FETCH_NUM)) { $count = (int) $row[0]; } else { $count = 0; // no rows returned; we infer that means 0 matches. } $stmt->closeCursor(); return $count; }
/** * Selects a collection of SystemEventInstance objects pre-filled with all related objects except User. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of SystemEventInstance objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptUser(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } SystemEventInstancePeer::addSelectColumns($criteria); $startcol2 = SystemEventInstancePeer::NUM_HYDRATE_COLUMNS; SystemEventPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + SystemEventPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(SystemEventInstancePeer::SYSTEM_EVENT_ID, SystemEventPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseSystemEventInstancePeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = SystemEventInstancePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = SystemEventInstancePeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = SystemEventInstancePeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); SystemEventInstancePeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined SystemEvent rows $key2 = SystemEventPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = SystemEventPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = SystemEventPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); SystemEventPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (SystemEventInstance) to the collection in $obj2 (SystemEvent) $obj2->addSystemEventInstance($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of Agenda objects pre-filled with all related objects except Especialidad. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of Agenda objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptEspecialidad(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(AgendaPeer::DATABASE_NAME); } AgendaPeer::addSelectColumns($criteria); $startcol2 = AgendaPeer::NUM_HYDRATE_COLUMNS; SalaquirurgicaPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + SalaquirurgicaPeer::NUM_HYDRATE_COLUMNS; QuirofanoPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + QuirofanoPeer::NUM_HYDRATE_COLUMNS; RiesgoqxPeer::addSelectColumns($criteria); $startcol5 = $startcol4 + RiesgoqxPeer::NUM_HYDRATE_COLUMNS; ContaminacionqxPeer::addSelectColumns($criteria); $startcol6 = $startcol5 + ContaminacionqxPeer::NUM_HYDRATE_COLUMNS; EventoqxPeer::addSelectColumns($criteria); $startcol7 = $startcol6 + EventoqxPeer::NUM_HYDRATE_COLUMNS; ProcedimientoPeer::addSelectColumns($criteria); $startcol8 = $startcol7 + ProcedimientoPeer::NUM_HYDRATE_COLUMNS; CausadiferidoPeer::addSelectColumns($criteria); $startcol9 = $startcol8 + CausadiferidoPeer::NUM_HYDRATE_COLUMNS; AtencionPeer::addSelectColumns($criteria); $startcol10 = $startcol9 + AtencionPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(AgendaPeer::SALA_ID, SalaquirurgicaPeer::ID, $join_behavior); $criteria->addJoin(AgendaPeer::QUIROFANO_ID, QuirofanoPeer::ID, $join_behavior); $criteria->addJoin(AgendaPeer::RIESGOQX_ID, RiesgoqxPeer::ID, $join_behavior); $criteria->addJoin(AgendaPeer::CONTAMINACIONQX_ID, ContaminacionqxPeer::ID, $join_behavior); $criteria->addJoin(AgendaPeer::EVENTOQX_ID, EventoqxPeer::ID, $join_behavior); $criteria->addJoin(AgendaPeer::TIPO_PROC_ID, ProcedimientoPeer::ID, $join_behavior); $criteria->addJoin(AgendaPeer::CAUSA_DIFERIDO_ID, CausadiferidoPeer::ID, $join_behavior); $criteria->addJoin(AgendaPeer::ATENCION_ID, AtencionPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseAgendaPeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = AgendaPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = AgendaPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = AgendaPeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); AgendaPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Salaquirurgica rows $key2 = SalaquirurgicaPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = SalaquirurgicaPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = SalaquirurgicaPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); SalaquirurgicaPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Agenda) to the collection in $obj2 (Salaquirurgica) $obj2->addAgenda($obj1); } // if joined row is not null // Add objects for joined Quirofano rows $key3 = QuirofanoPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = QuirofanoPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = QuirofanoPeer::getOMClass(); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); QuirofanoPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Agenda) to the collection in $obj3 (Quirofano) $obj3->addAgenda($obj1); } // if joined row is not null // Add objects for joined Riesgoqx rows $key4 = RiesgoqxPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = RiesgoqxPeer::getInstanceFromPool($key4); if (!$obj4) { $cls = RiesgoqxPeer::getOMClass(); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); RiesgoqxPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (Agenda) to the collection in $obj4 (Riesgoqx) $obj4->addAgenda($obj1); } // if joined row is not null // Add objects for joined Contaminacionqx rows $key5 = ContaminacionqxPeer::getPrimaryKeyHashFromRow($row, $startcol5); if ($key5 !== null) { $obj5 = ContaminacionqxPeer::getInstanceFromPool($key5); if (!$obj5) { $cls = ContaminacionqxPeer::getOMClass(); $obj5 = new $cls(); $obj5->hydrate($row, $startcol5); ContaminacionqxPeer::addInstanceToPool($obj5, $key5); } // if $obj5 already loaded // Add the $obj1 (Agenda) to the collection in $obj5 (Contaminacionqx) $obj5->addAgenda($obj1); } // if joined row is not null // Add objects for joined Eventoqx rows $key6 = EventoqxPeer::getPrimaryKeyHashFromRow($row, $startcol6); if ($key6 !== null) { $obj6 = EventoqxPeer::getInstanceFromPool($key6); if (!$obj6) { $cls = EventoqxPeer::getOMClass(); $obj6 = new $cls(); $obj6->hydrate($row, $startcol6); EventoqxPeer::addInstanceToPool($obj6, $key6); } // if $obj6 already loaded // Add the $obj1 (Agenda) to the collection in $obj6 (Eventoqx) $obj6->addAgenda($obj1); } // if joined row is not null // Add objects for joined Procedimiento rows $key7 = ProcedimientoPeer::getPrimaryKeyHashFromRow($row, $startcol7); if ($key7 !== null) { $obj7 = ProcedimientoPeer::getInstanceFromPool($key7); if (!$obj7) { $cls = ProcedimientoPeer::getOMClass(); $obj7 = new $cls(); $obj7->hydrate($row, $startcol7); ProcedimientoPeer::addInstanceToPool($obj7, $key7); } // if $obj7 already loaded // Add the $obj1 (Agenda) to the collection in $obj7 (Procedimiento) $obj7->addAgenda($obj1); } // if joined row is not null // Add objects for joined Causadiferido rows $key8 = CausadiferidoPeer::getPrimaryKeyHashFromRow($row, $startcol8); if ($key8 !== null) { $obj8 = CausadiferidoPeer::getInstanceFromPool($key8); if (!$obj8) { $cls = CausadiferidoPeer::getOMClass(); $obj8 = new $cls(); $obj8->hydrate($row, $startcol8); CausadiferidoPeer::addInstanceToPool($obj8, $key8); } // if $obj8 already loaded // Add the $obj1 (Agenda) to the collection in $obj8 (Causadiferido) $obj8->addAgenda($obj1); } // if joined row is not null // Add objects for joined Atencion rows $key9 = AtencionPeer::getPrimaryKeyHashFromRow($row, $startcol9); if ($key9 !== null) { $obj9 = AtencionPeer::getInstanceFromPool($key9); if (!$obj9) { $cls = AtencionPeer::getOMClass(); $obj9 = new $cls(); $obj9->hydrate($row, $startcol9); AtencionPeer::addInstanceToPool($obj9, $key9); } // if $obj9 already loaded // Add the $obj1 (Agenda) to the collection in $obj9 (Atencion) $obj9->addAgenda($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Returns true if the passed model name is taggable * * @param mixed $model * @return boolean */ public static function isTaggable($model) { if (is_object($model)) { $model = get_class($model); } if (!is_string($model)) { throw new Exception('The param passed to the method isTaggable must be an object or a string.'); } $base_class = sprintf('Base%s', ucfirst($model)); $callables = sfMixer::getCallables($base_class . ':save:post'); $callables_count = count($callables); $i = 0; $is_taggable = false; while (!$is_taggable && $i < $callables_count) { $callable = $callables[$i][0]; $is_taggable = is_object($callable) && get_class($callable) == 'sfPropelActAsTaggableBehavior'; $i++; } return $is_taggable; }
public function save($con = null) { foreach (sfMixer::getCallables('BaseTemplate:save:pre') as $callable) { $affectedRows = call_user_func($callable, $this, $con); if (is_int($affectedRows)) { return $affectedRows; } } if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(TemplatePeer::DATABASE_NAME); } try { $con->begin(); $affectedRows = $this->doSave($con); $con->commit(); foreach (sfMixer::getCallables('BaseTemplate:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } return $affectedRows; } catch (PropelException $e) { $con->rollback(); throw $e; } }
/** * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. * * Use this method directly if you want to work with an executed statement durirectly (for example * to perform your own object hydration). * * @param Criteria $criteria The Criteria object used to build the SELECT statement. * @param PropelPDO $con The connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. * @return PDOStatement The executed PDOStatement object. * @see BasePeer::doSelect() */ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(ProveedorPeer::DATABASE_NAME, Propel::CONNECTION_READ); } if (!$criteria->hasSelectClause()) { $criteria = clone $criteria; ProveedorPeer::addSelectColumns($criteria); } // Set the correct dbName $criteria->setDbName(self::DATABASE_NAME); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseProveedorPeer', $criteria, $con); } // BasePeer returns a PDOStatement return BasePeer::doSelect($criteria, $con); }
/** * Forwards the request to another action. * * @param string A module name * @param string An action name * * @throws <b>sfConfigurationException</b> If an invalid configuration setting has been found * @throws <b>sfForwardException</b> If an error occurs while forwarding the request * @throws <b>sfInitializationException</b> If the action could not be initialized * @throws <b>sfSecurityException</b> If the action requires security but the user implementation is not of type sfSecurityUser */ public function forward($moduleName, $actionName) { // replace unwanted characters $moduleName = preg_replace('/[^a-z0-9\\-_]+/i', '', $moduleName); $actionName = preg_replace('/[^a-z0-9\\-_]+/i', '', $actionName); if ($this->getActionStack()->getSize() >= $this->maxForwards) { // let's kill this party before it turns into cpu cycle hell $error = 'Too many forwards have been detected for this request (> %d)'; $error = sprintf($error, $this->maxForwards); throw new sfForwardException($error); } $rootDir = sfConfig::get('sf_root_dir'); $app = sfConfig::get('sf_app'); $env = sfConfig::get('sf_environment'); if (!sfConfig::get('sf_available') || sfToolkit::hasLockFile($rootDir . '/' . $app . '_' . $env . '.lck')) { // application is unavailable $moduleName = sfConfig::get('sf_unavailable_module'); $actionName = sfConfig::get('sf_unavailable_action'); if (!$this->actionExists($moduleName, $actionName)) { // cannot find unavailable module/action $error = 'Invalid configuration settings: [sf_unavailable_module] "%s", [sf_unavailable_action] "%s"'; $error = sprintf($error, $moduleName, $actionName); throw new sfConfigurationException($error); } } // check for a module generator config file sfConfigCache::getInstance()->import(sfConfig::get('sf_app_module_dir_name') . '/' . $moduleName . '/' . sfConfig::get('sf_app_module_config_dir_name') . '/generator.yml', true, true); if (!$this->actionExists($moduleName, $actionName)) { // the requested action doesn't exist if (sfConfig::get('sf_logging_enabled')) { $this->getContext()->getLogger()->info(sprintf('{sfController} action "%s/%s" does not exist', $moduleName, $actionName)); } // track the requested module so we have access to the data in the error 404 page $this->context->getRequest()->setAttribute('requested_action', $actionName); $this->context->getRequest()->setAttribute('requested_module', $moduleName); // switch to error 404 action $moduleName = sfConfig::get('sf_error_404_module'); $actionName = sfConfig::get('sf_error_404_action'); if (!$this->actionExists($moduleName, $actionName)) { // cannot find unavailable module/action $error = 'Invalid configuration settings: [sf_error_404_module] "%s", [sf_error_404_action] "%s"'; $error = sprintf($error, $moduleName, $actionName); throw new sfConfigurationException($error); } } // create an instance of the action $actionInstance = $this->getAction($moduleName, $actionName); // add a new action stack entry $this->getActionStack()->addEntry($moduleName, $actionName, $actionInstance); // include module configuration require sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name') . '/' . $moduleName . '/' . sfConfig::get('sf_app_module_config_dir_name') . '/module.yml'); // check if this module is internal if ($this->getActionStack()->getSize() == 1 && sfConfig::get('mod_' . strtolower($moduleName) . '_is_internal') && !sfConfig::get('sf_test')) { $error = 'Action "%s" from module "%s" cannot be called directly'; $error = sprintf($error, $actionName, $moduleName); throw new sfConfigurationException($error); } if (sfConfig::get('mod_' . strtolower($moduleName) . '_enabled')) { // module is enabled // check for a module config.php $moduleConfig = sfConfig::get('sf_app_module_dir') . '/' . $moduleName . '/' . sfConfig::get('sf_app_module_config_dir_name') . '/config.php'; if (is_readable($moduleConfig)) { require_once $moduleConfig; } // initialize the action if ($actionInstance->initialize($this->context)) { // create a new filter chain $filterChain = new sfFilterChain(); $this->loadFilters($filterChain, $actionInstance); if ($moduleName == sfConfig::get('sf_error_404_module') && $actionName == sfConfig::get('sf_error_404_action')) { $this->getContext()->getResponse()->setStatusCode(404); $this->getContext()->getResponse()->setHttpHeader('Status', '404 Not Found'); foreach (sfMixer::getCallables('sfController:forward:error404') as $callable) { call_user_func($callable, $this, $moduleName, $actionName); } } // change i18n message source directory to our module if (sfConfig::get('sf_i18n')) { $this->context->getI18N()->setMessageSourceDir(sfLoader::getI18NDir($moduleName), $this->context->getUser()->getCulture()); } // process the filter chain $filterChain->execute(); } else { // action failed to initialize $error = 'Action initialization failed for module "%s", action "%s"'; $error = sprintf($error, $moduleName, $actionName); throw new sfInitializationException($error); } } else { // module is disabled $moduleName = sfConfig::get('sf_module_disabled_module'); $actionName = sfConfig::get('sf_module_disabled_action'); if (!$this->actionExists($moduleName, $actionName)) { // cannot find mod disabled module/action $error = 'Invalid configuration settings: [sf_module_disabled_module] "%s", [sf_module_disabled_action] "%s"'; $error = sprintf($error, $moduleName, $actionName); throw new sfConfigurationException($error); } $this->forward($moduleName, $actionName); } }
/** * Selects a collection of GalleryImage objects pre-filled with all related objects. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of GalleryImage objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(GalleryImagePeer::DATABASE_NAME); } GalleryImagePeer::addSelectColumns($criteria); $startcol2 = GalleryImagePeer::NUM_HYDRATE_COLUMNS; GalleryFolderPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + GalleryFolderPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(GalleryImagePeer::GALLERY_FOLDER_ID, GalleryFolderPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseGalleryImagePeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = GalleryImagePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = GalleryImagePeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = GalleryImagePeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); GalleryImagePeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined GalleryFolder rows $key2 = GalleryFolderPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = GalleryFolderPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = GalleryFolderPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); GalleryFolderPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (GalleryImage) to the collection in $obj2 (GalleryFolder) $obj2->addGalleryImage($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of Cliente objects pre-filled with all related objects except CiudadRelatedByIdCiudad. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of Cliente objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptCiudadRelatedByIdCiudad(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } ClientePeer::addSelectColumns($criteria); $startcol2 = ClientePeer::NUM_HYDRATE_COLUMNS; // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseClientePeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = ClientePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = ClientePeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = ClientePeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); ClientePeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of Afiliado objects pre-filled with all related objects except Localidad. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of Afiliado objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptLocalidad(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } AfiliadoPeer::addSelectColumns($criteria); $startcol2 = AfiliadoPeer::NUM_HYDRATE_COLUMNS; PlanPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + PlanPeer::NUM_HYDRATE_COLUMNS; TipodocPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + TipodocPeer::NUM_HYDRATE_COLUMNS; ReparticionPeer::addSelectColumns($criteria); $startcol5 = $startcol4 + ReparticionPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(AfiliadoPeer::PLAN_ID, PlanPeer::ID, $join_behavior); $criteria->addJoin(AfiliadoPeer::TIPODOC_ID, TipodocPeer::ID, $join_behavior); $criteria->addJoin(AfiliadoPeer::REPARTICION_ID, ReparticionPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseAfiliadoPeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = AfiliadoPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = AfiliadoPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = AfiliadoPeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); AfiliadoPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Plan rows $key2 = PlanPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = PlanPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = PlanPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); PlanPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Afiliado) to the collection in $obj2 (Plan) $obj2->addAfiliado($obj1); } // if joined row is not null // Add objects for joined Tipodoc rows $key3 = TipodocPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = TipodocPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = TipodocPeer::getOMClass(); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); TipodocPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Afiliado) to the collection in $obj3 (Tipodoc) $obj3->addAfiliado($obj1); } // if joined row is not null // Add objects for joined Reparticion rows $key4 = ReparticionPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = ReparticionPeer::getInstanceFromPool($key4); if (!$obj4) { $cls = ReparticionPeer::getOMClass(); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); ReparticionPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (Afiliado) to the collection in $obj4 (Reparticion) $obj4->addAfiliado($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Persists this object to the database. * * If the object is new, it inserts it; otherwise an update is performed. * All modified related objects will also be persisted in the doSave() * method. This method wraps all precipitate database operations in a * single transaction. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @throws Exception * @see doSave() */ public function save(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(CausadiferidoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); $isInsert = $this->isNew(); try { $ret = $this->preSave($con); // nested_set behavior if ($this->isNew() && $this->isRoot()) { // check if no other root exist in, the tree $nbRoots = CausadiferidoQuery::create()->addUsingAlias(CausadiferidoPeer::LEFT_COL, 1, Criteria::EQUAL)->addUsingAlias(CausadiferidoPeer::SCOPE_COL, $this->getScopeValue(), Criteria::EQUAL)->count($con); if ($nbRoots > 0) { throw new PropelException(sprintf('A root node already exists in this tree with scope "%s".', $this->getScopeValue())); } } $this->processNestedSetQueries($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseCausadiferido:save:pre') as $callable) { if (is_integer($affectedRows = call_user_func($callable, $this, $con))) { $con->commit(); return $affectedRows; } } // symfony_timestampable behavior if ($this->isModified() && !$this->isColumnModified(CausadiferidoPeer::UPDATED_AT)) { $this->setUpdatedAt(time()); } if ($isInsert) { $ret = $ret && $this->preInsert($con); // symfony_timestampable behavior if (!$this->isColumnModified(CausadiferidoPeer::CREATED_AT)) { $this->setCreatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); } if ($ret) { $affectedRows = $this->doSave($con); if ($isInsert) { $this->postInsert($con); } else { $this->postUpdate($con); } $this->postSave($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseCausadiferido:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } CausadiferidoPeer::addInstanceToPool($this); } else { $affectedRows = 0; } $con->commit(); return $affectedRows; } catch (Exception $e) { $con->rollBack(); throw $e; } }
/** * Selects a collection of sfSimpleForumPost objects pre-filled with related topic and forum objects. * * @return array Array of sfSimpleForumPost objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinTopicAndForum(Criteria $c, $con = null) { foreach (sfMixer::getCallables('BasesfSimpleForumPostPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) { call_user_func($callable, 'BasesfSimpleForumPostPeer', $c, $con); } $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } sfSimpleForumPostPeer::addSelectColumns($c); $startcol2 = sfSimpleForumPostPeer::NUM_COLUMNS - sfSimpleForumPostPeer::NUM_LAZY_LOAD_COLUMNS + 1; sfSimpleForumTopicPeer::addSelectColumns($c); $startcol3 = $startcol2 + sfSimpleForumTopicPeer::NUM_COLUMNS; sfSimpleForumForumPeer::addSelectColumns($c); $startcol4 = $startcol3 + sfSimpleForumForumPeer::NUM_COLUMNS; $c->addJoin(sfSimpleForumPostPeer::TOPIC_ID, sfSimpleForumTopicPeer::ID); $c->addJoin(sfSimpleForumPostPeer::FORUM_ID, sfSimpleForumForumPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $post = new sfSimpleForumPost(); $post->hydrate($rs); $topic = new sfSimpleForumTopic(); $topic->hydrate($rs, $startcol2); $newObject = true; foreach ($results as $temp_post) { $existing_topic = $temp_post->getsfSimpleForumTopic(); if ($existing_topic->getPrimaryKey() === $topic->getPrimaryKey()) { $newObject = false; $existing_topic->addsfSimpleForumPost($post); break; } } if ($newObject) { $topic->initsfSimpleForumPosts(); $topic->addsfSimpleForumPost($post); } $forum = new sfSimpleForumForum(); $forum->hydrate($rs, $startcol3); $newObject = true; foreach ($results as $temp_post) { $existing_forum = $temp_post->getsfSimpleForumForum(); if ($existing_forum->getPrimaryKey() === $forum->getPrimaryKey()) { $newObject = false; $existing_forum->addsfSimpleForumPost($post); break; } } if ($newObject) { $forum->initsfSimpleForumPosts(); $forum->addsfSimpleForumPost($post); } $results[] = $post; } return $results; }
myClass::$retStatic .= "in myStaticMethodWithArgs mixin method ({$arg1}, {$arg2})\n"; } public function newMethod($object) { return "in newMethod mixin method\n"; } public function newMethodWithArgs($object, $arg1, $arg2 = 'default') { return "in newMethodWithArgs mixin method ({$arg1}, {$arg2})\n"; } } sfMixer::register('myClass:myMethod', array('myClassMixins', 'myMixinMethod')); sfMixer::register('myClass:myStaticMethod', array('myClassMixins', 'myMixinStaticMethod')); $t->is($m->myMethod(), "before myMethod\nin myMethod mixin method\nafter myMethod\n", 'method call with a mixin'); $t->is(myClass::myStaticMethod(), "before myStaticMethod\nin myStaticMethod mixin method\nafter myStaticMethod\n", 'static method call with a mixin'); sfMixer::register('myClass:myMethodWithArgs', array('myClassMixins', 'myMixinMethodWithArgs')); $t->is($m->myMethodWithArgs('value'), "before myMethodWithArgs\nin myMethodWithArgs mixin method (value, default)\nafter myMethodWithArgs\n", 'method call with arguments with a mixin'); sfMixer::register('myClass:myMethodWithArgs', array('myClassMixins', 'myMixinMethodWithArgs')); $t->is(count(sfMixer::getCallables('myClass:myMethodWithArgs:myMethodWithArgs')), 1, '::register() registers a mixin only once'); sfMixer::register('myClass:myMethodWithArgs', array('myClassMixins', 'myMixinMethodWithArgs'), true); $t->is(count(sfMixer::getCallables('myClass:myMethodWithArgs:myMethodWithArgs')), 2, '::register() registers a mixin multiple times if the last argument is true'); sfMixer::register('myClass:myStaticMethodWithArgs', array('myClassMixins', 'myMixinStaticMethodWithArgs')); $t->is(myClass::myStaticMethodWithArgs('value'), "before myStaticMethodWithArgs\nin myStaticMethodWithArgs mixin method (value, default)\nafter myStaticMethodWithArgs\n", 'static method call with arguments with a mixin'); sfMixer::register('myClass', array('myClassMixins', 'newMethod')); $t->is($m->newMethod(), "before __call\nin newMethod mixin method\nafter __call\n", 'method call from a mixin'); sfMixer::register('myClass', array('myClassMixins', 'newMethodWithArgs')); $t->is($m->newMethodWithArgs('value'), "before __call\nin newMethodWithArgs mixin method (value, default)\nafter __call\n", 'method call from a mixin with arguments'); sfMixer::register('myClass:myMethodWithSeveralHooks:before', array('myClassMixins', 'myMethodWithSeveralHooksBefore')); sfMixer::register('myClass:myMethodWithSeveralHooks', array('myClassMixins', 'myMethodWithSeveralHooks')); sfMixer::register('myClass:myMethodWithSeveralHooks:after', array('myClassMixins', 'myMethodWithSeveralHooksAfter')); $t->is($m->myMethodWithSeveralHooks(), "before myMethodWithSeveralHooks\nin myMethodWithSeveralHooks mixin method for before hook\nmyMethodWithSeveralHooks\nin myMethodWithSeveralHooks mixin method for default hook\nafter myMethodWithSeveralHooks\nin myMethodWithSeveralHooks mixin method for after hook\n", 'method call with several registered hooks');
public function forward($moduleName, $actionName) { $moduleName = preg_replace('/[^a-z0-9\\-_]+/i', '', $moduleName); $actionName = preg_replace('/[^a-z0-9\\-_]+/i', '', $actionName); if ($this->getActionStack()->getSize() >= $this->maxForwards) { $error = 'Too many forwards have been detected for this request (> %d)'; $error = sprintf($error, $this->maxForwards); throw new sfForwardException($error); } $rootDir = sfConfig::get('sf_root_dir'); $app = sfConfig::get('sf_app'); $env = sfConfig::get('sf_environment'); if (!sfConfig::get('sf_available') || sfToolkit::hasLockFile($rootDir . '/' . $app . '_' . $env . '.clilock')) { $moduleName = sfConfig::get('sf_unavailable_module'); $actionName = sfConfig::get('sf_unavailable_action'); if (!$this->actionExists($moduleName, $actionName)) { $error = 'Invalid configuration settings: [sf_unavailable_module] "%s", [sf_unavailable_action] "%s"'; $error = sprintf($error, $moduleName, $actionName); throw new sfConfigurationException($error); } } sfConfigCache::getInstance()->import(sfConfig::get('sf_app_module_dir_name') . '/' . $moduleName . '/' . sfConfig::get('sf_app_module_config_dir_name') . '/generator.yml', true, true); if (!$this->actionExists($moduleName, $actionName)) { if (sfConfig::get('sf_logging_enabled')) { $this->getContext()->getLogger()->info(sprintf('{sfController} action "%s/%s" does not exist', $moduleName, $actionName)); } $this->context->getRequest()->setAttribute('requested_action', $actionName); $this->context->getRequest()->setAttribute('requested_module', $moduleName); $moduleName = sfConfig::get('sf_error_404_module'); $actionName = sfConfig::get('sf_error_404_action'); if (!$this->actionExists($moduleName, $actionName)) { $error = 'Invalid configuration settings: [sf_error_404_module] "%s", [sf_error_404_action] "%s"'; $error = sprintf($error, $moduleName, $actionName); throw new sfConfigurationException($error); } } $actionInstance = $this->getAction($moduleName, $actionName); $this->getActionStack()->addEntry($moduleName, $actionName, $actionInstance); require sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name') . '/' . $moduleName . '/' . sfConfig::get('sf_app_module_config_dir_name') . '/module.yml'); if ($this->getActionStack()->getSize() == 1 && sfConfig::get('mod_' . strtolower($moduleName) . '_is_internal') && !sfConfig::get('sf_test')) { $error = 'Action "%s" from module "%s" cannot be called directly'; $error = sprintf($error, $actionName, $moduleName); throw new sfConfigurationException($error); } if (sfConfig::get('mod_' . strtolower($moduleName) . '_enabled')) { $moduleConfig = sfConfig::get('sf_app_module_dir') . '/' . $moduleName . '/' . sfConfig::get('sf_app_module_config_dir_name') . '/config.php'; if (is_readable($moduleConfig)) { require_once $moduleConfig; } if ($actionInstance->initialize($this->context)) { $filterChain = new sfFilterChain(); $this->loadFilters($filterChain, $actionInstance); if ($moduleName == sfConfig::get('sf_error_404_module') && $actionName == sfConfig::get('sf_error_404_action')) { $this->getContext()->getResponse()->setStatusCode(404); $this->getContext()->getResponse()->setHttpHeader('Status', '404 Not Found'); foreach (sfMixer::getCallables('sfController:forward:error404') as $callable) { call_user_func($callable, $this, $moduleName, $actionName); } } if (sfConfig::get('sf_i18n')) { $this->context->getI18N()->setMessageSourceDir(sfLoader::getI18NDir($moduleName), $this->context->getUser()->getCulture()); } $filterChain->execute(); } else { $error = 'Action initialization failed for module "%s", action "%s"'; $error = sprintf($error, $moduleName, $actionName); throw new sfInitializationException($error); } } else { $moduleName = sfConfig::get('sf_module_disabled_module'); $actionName = sfConfig::get('sf_module_disabled_action'); if (!$this->actionExists($moduleName, $actionName)) { $error = 'Invalid configuration settings: [sf_module_disabled_module] "%s", [sf_module_disabled_action] "%s"'; $error = sprintf($error, $moduleName, $actionName); throw new sfConfigurationException($error); } $this->forward($moduleName, $actionName); } }
/** * Selects a collection of StatusAction objects pre-filled with all related objects except File. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of StatusAction objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptFile(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } StatusActionPeer::addSelectColumns($criteria); $startcol2 = StatusActionPeer::NUM_HYDRATE_COLUMNS; sfGuardUserPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + sfGuardUserPeer::NUM_HYDRATE_COLUMNS; RepositoryPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + RepositoryPeer::NUM_HYDRATE_COLUMNS; BranchPeer::addSelectColumns($criteria); $startcol5 = $startcol4 + BranchPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(StatusActionPeer::USER_ID, sfGuardUserPeer::ID, $join_behavior); $criteria->addJoin(StatusActionPeer::REPOSITORY_ID, RepositoryPeer::ID, $join_behavior); $criteria->addJoin(StatusActionPeer::BRANCH_ID, BranchPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseStatusActionPeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = StatusActionPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = StatusActionPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = StatusActionPeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); StatusActionPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined sfGuardUser rows $key2 = sfGuardUserPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = sfGuardUserPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = sfGuardUserPeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); sfGuardUserPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (StatusAction) to the collection in $obj2 (sfGuardUser) $obj2->addStatusAction($obj1); } // if joined row is not null // Add objects for joined Repository rows $key3 = RepositoryPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = RepositoryPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = RepositoryPeer::getOMClass(false); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); RepositoryPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (StatusAction) to the collection in $obj3 (Repository) $obj3->addStatusAction($obj1); } // if joined row is not null // Add objects for joined Branch rows $key4 = BranchPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = BranchPeer::getInstanceFromPool($key4); if (!$obj4) { $cls = BranchPeer::getOMClass(false); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); BranchPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (StatusAction) to the collection in $obj4 (Branch) $obj4->addStatusAction($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Persists this object to the database. * * If the object is new, it inserts it; otherwise an update is performed. * All modified related objects will also be persisted in the doSave() * method. This method wraps all precipitate database operations in a * single transaction. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see doSave() */ public function save(PropelPDO $con = null) { foreach (sfMixer::getCallables('BasesfGuardRememberKey:save:pre') as $callable) { $affectedRows = call_user_func($callable, $this, $con); if (is_int($affectedRows)) { return $affectedRows; } } if ($this->isNew() && !$this->isColumnModified(sfGuardRememberKeyPeer::CREATED_AT)) { $this->setCreatedAt(time()); } if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(sfGuardRememberKeyPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $affectedRows = $this->doSave($con); $con->commit(); foreach (sfMixer::getCallables('BasesfGuardRememberKey:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } sfGuardRememberKeyPeer::addInstanceToPool($this); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } }
public static function doSelectJoinCustom(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { foreach (sfMixer::getCallables('MissionPeer:doSelectJoinCustom:doSelectJoinCustom') as $callable) { call_user_func($callable, 'MissionPeer', $c, $con); } $c = clone $c; // Set the correct dbName if it has not been overridden if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } MissionPeer::addSelectColumns($c); $startcol2 = MissionPeer::NUM_COLUMNS - MissionPeer::NUM_LAZY_LOAD_COLUMNS; ItineraryPeer::addSelectColumns($c); $startcol3 = $startcol2 + (ItineraryPeer::NUM_COLUMNS - ItineraryPeer::NUM_LAZY_LOAD_COLUMNS); MissionTypePeer::addSelectColumns($c); $startcol4 = $startcol3 + (MissionTypePeer::NUM_COLUMNS - MissionTypePeer::NUM_LAZY_LOAD_COLUMNS); PassengerPeer::addSelectColumns($c); $startcol5 = $startcol4 + (PassengerPeer::NUM_COLUMNS - PassengerPeer::NUM_LAZY_LOAD_COLUMNS); MissionLegPeer::addSelectColumns($c); $startcol6 = $startcol5 + (MissionLegPeer::NUM_COLUMNS - MissionLegPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(MissionPeer::ITINERARY_ID), array(ItineraryPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::MISSION_TYPE_ID), array(MissionTypePeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::PASSENGER_ID), array(PassengerPeer::ID), $join_behavior); $c->addJoin(array(MissionPeer::ID), array(MissionLegPeer::MISSION_ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = MissionPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = MissionPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $omClass = MissionPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); MissionPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Itinerary rows $key2 = ItineraryPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = ItineraryPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = ItineraryPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); ItineraryPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (Mission) to the collection in $obj3 (Itinerary) $obj2->addMission($obj1); } // if joined row not null // Add objects for joined MissionType rows $key3 = MissionTypePeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = MissionTypePeer::getInstanceFromPool($key3); if (!$obj3) { $omClass = MissionTypePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); MissionTypePeer::addInstanceToPool($obj3, $key3); } // if obj3 loaded // Add the $obj1 (Mission) to the collection in $obj3 (MissionType) $obj3->addMission($obj1); } // if joined row not null // Add objects for joined Passenger rows $key4 = PassengerPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = PassengerPeer::getInstanceFromPool($key4); if (!$obj4) { $omClass = PassengerPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); PassengerPeer::addInstanceToPool($obj4, $key4); } // if obj4 loaded // Add the $obj1 (Mission) to the collection in $obj4 (Passenger) $obj4->addMission($obj1); } // if joined row not null // Add objects for joined MissionLeg rows $key5 = MissionLegPeer::getPrimaryKeyHashFromRow($row, $startcol5); if ($key5 !== null) { $obj5 = MissionLegPeer::getInstanceFromPool($key5); if (!$obj5) { $omClass = MissionLegPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj5 = new $cls(); $obj5->hydrate($row, $startcol5); MissionLegPeer::addInstanceToPool($obj5, $key5); } // if obj5 loaded // Add the $obj1 (Mission) to the collection in $obj5 (MissionLeg) $obj5->setMission($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public function save($con = null) { foreach (sfMixer::getCallables('BaseCoFormApplication:save:pre') as $callable) { $affectedRows = call_user_func($callable, $this, $con); if (is_int($affectedRows)) { return $affectedRows; } } if ($this->isNew() && !$this->isColumnModified(CoFormApplicationPeer::CREATED_AT)) { $this->setCreatedAt(time()); } if ($this->isModified() && !$this->isColumnModified(CoFormApplicationPeer::UPDATED_AT)) { $this->setUpdatedAt(time()); } if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(CoFormApplicationPeer::DATABASE_NAME); } try { $con->begin(); $affectedRows = $this->doSave($con); $con->commit(); foreach (sfMixer::getCallables('BaseCoFormApplication:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } return $affectedRows; } catch (PropelException $e) { $con->rollback(); throw $e; } }
public static function doUpdate($values, $con = null) { foreach (sfMixer::getCallables('BasenahoWikiPagePeer:doUpdate:pre') as $callable) { $ret = call_user_func($callable, 'BasenahoWikiPagePeer', $values, $con); if (false !== $ret) { return $ret; } } if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { $criteria = clone $values; $comparison = $criteria->getComparison(nahoWikiPagePeer::ID); $selectCriteria->add(nahoWikiPagePeer::ID, $criteria->remove(nahoWikiPagePeer::ID), $comparison); } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); } $criteria->setDbName(self::DATABASE_NAME); $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con); foreach (sfMixer::getCallables('BasenahoWikiPagePeer:doUpdate:post') as $callable) { call_user_func($callable, 'BasenahoWikiPagePeer', $values, $con, $ret); } return $ret; }
/** * Persists this object to the database. * * If the object is new, it inserts it; otherwise an update is performed. * All modified related objects will also be persisted in the doSave() * method. This method wraps all precipitate database operations in a * single transaction. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see doSave() */ public function save(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(sfGuardUserPermissionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); $isInsert = $this->isNew(); try { $ret = $this->preSave($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BasesfGuardUserPermission:save:pre') as $callable) { if (is_integer($affectedRows = call_user_func($callable, $this, $con))) { return $affectedRows; } } if ($isInsert) { $ret = $ret && $this->preInsert($con); } else { $ret = $ret && $this->preUpdate($con); } if ($ret) { $affectedRows = $this->doSave($con); if ($isInsert) { $this->postInsert($con); } else { $this->postUpdate($con); } $this->postSave($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BasesfGuardUserPermission:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } sfGuardUserPermissionPeer::addInstanceToPool($this); } else { $affectedRows = 0; } $con->commit(); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } }
/** * Persists this object to the database. * * If the object is new, it inserts it; otherwise an update is performed. * All modified related objects will also be persisted in the doSave() * method. This method wraps all precipitate database operations in a * single transaction. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see doSave() */ public function save(PropelPDO $con = null) { foreach (sfMixer::getCallables('BaseEnumItem:save:pre') as $callable) { $affectedRows = call_user_func($callable, $this, $con); if (is_int($affectedRows)) { return $affectedRows; } } if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(EnumItemPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $affectedRows = $this->doSave($con); $con->commit(); foreach (sfMixer::getCallables('BaseEnumItem:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } EnumItemPeer::addInstanceToPool($this); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } }
/** * Method perform an UPDATE on the database, given a PcBlogComment or Criteria object. * * @param mixed $values Criteria or PcBlogComment object containing data that is used to create the UPDATE statement. * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). * @return int The number of affected rows (if supported by underlying database driver). * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doUpdate($values, PropelPDO $con = null) { // symfony_behaviors behavior foreach (sfMixer::getCallables('BasePcBlogCommentPeer:doUpdate:pre') as $sf_hook) { if (false !== ($sf_hook_retval = call_user_func($sf_hook, 'BasePcBlogCommentPeer', $values, $con))) { return $sf_hook_retval; } } if ($con === null) { $con = Propel::getConnection(PcBlogCommentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { $criteria = clone $values; // rename for clarity $comparison = $criteria->getComparison(PcBlogCommentPeer::ID); $selectCriteria->add(PcBlogCommentPeer::ID, $criteria->remove(PcBlogCommentPeer::ID), $comparison); } else { // $values is PcBlogComment object $criteria = $values->buildCriteria(); // gets full criteria $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) } // set the correct dbName $criteria->setDbName(self::DATABASE_NAME); $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BasePcBlogCommentPeer:doUpdate:post') as $sf_hook) { call_user_func($sf_hook, 'BasePcBlogCommentPeer', $values, $con, $ret); } return $ret; }
public static function doSelectJoinCategoryLeftJoinPost(Criteria $c, $con = null) { foreach (sfMixer::getCallables('BasesfSimpleForumForumPeer:doSelectJoinAll:doSelectJoinAll') as $callable) { call_user_func($callable, 'BasesfSimpleForumForumPeer', $c, $con); } $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } sfSimpleForumForumPeer::addSelectColumns($c); $startcol2 = sfSimpleForumForumPeer::NUM_COLUMNS - sfSimpleForumForumPeer::NUM_LAZY_LOAD_COLUMNS + 1; sfSimpleForumCategoryPeer::addSelectColumns($c); $startcol3 = $startcol2 + sfSimpleForumCategoryPeer::NUM_COLUMNS; sfSimpleForumPostPeer::addSelectColumns($c); $startcol4 = $startcol3 + sfSimpleForumPostPeer::NUM_COLUMNS; $c->addJoin(sfSimpleForumForumPeer::CATEGORY_ID, sfSimpleForumCategoryPeer::ID); $c->addJoin(sfSimpleForumForumPeer::LATEST_POST_ID, sfSimpleForumPostPeer::ID, Criteria::LEFT_JOIN); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = sfSimpleForumForumPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = sfSimpleForumCategoryPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getsfSimpleForumCategory(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addsfSimpleForumForum($obj1); break; } } if ($newObject) { $obj2->initsfSimpleForumForums(); $obj2->addsfSimpleForumForum($obj1); } $omClass = sfSimpleForumPostPeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getsfSimpleForumPost(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addsfSimpleForumForum($obj1); break; } } if ($newObject) { $obj3->initsfSimpleForumForums(); $obj3->addsfSimpleForumForum($obj1); } $results[] = $obj1; } return $results; }
/** * Method perform an UPDATE on the database, given a ExamCommentDig or Criteria object. * * @param mixed $values Criteria or ExamCommentDig object containing data that is used to create the UPDATE statement. * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). * @return int The number of affected rows (if supported by underlying database driver). * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doUpdate($values, PropelPDO $con = null) { foreach (sfMixer::getCallables('BaseExamCommentDigPeer:doUpdate:pre') as $callable) { $ret = call_user_func($callable, 'BaseExamCommentDigPeer', $values, $con); if (false !== $ret) { return $ret; } } if ($con === null) { $con = Propel::getConnection(ExamCommentDigPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $selectCriteria = new Criteria(self::DATABASE_NAME); if ($values instanceof Criteria) { $criteria = clone $values; // rename for clarity $comparison = $criteria->getComparison(ExamCommentDigPeer::IP); $selectCriteria->add(ExamCommentDigPeer::IP, $criteria->remove(ExamCommentDigPeer::IP), $comparison); $comparison = $criteria->getComparison(ExamCommentDigPeer::COMMENT_ID); $selectCriteria->add(ExamCommentDigPeer::COMMENT_ID, $criteria->remove(ExamCommentDigPeer::COMMENT_ID), $comparison); } else { // $values is ExamCommentDig object $criteria = $values->buildCriteria(); // gets full criteria $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) } // set the correct dbName $criteria->setDbName(self::DATABASE_NAME); $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con); foreach (sfMixer::getCallables('BaseExamCommentDigPeer:doUpdate:post') as $callable) { call_user_func($callable, 'BaseExamCommentDigPeer', $values, $con, $ret); } return $ret; }
/** * Prints the stack trace for this exception. * * @param Exception An Exception implementation instance */ public function printStackTrace($exception = null) { if (!$exception) { $exception = $this; } // don't print message if it is an sfStopException exception if (method_exists($exception, 'getName') && $exception->getName() == 'sfStopException') { if (!sfConfig::get('sf_test')) { exit(1); } return; } if (class_exists('sfMixer', false)) { foreach (sfMixer::getCallables('sfException:printStackTrace:printStackTrace') as $callable) { $ret = call_user_func($callable, $this, $exception); if ($ret) { if (!sfConfig::get('sf_test')) { exit(1); } return; } } } if (!sfConfig::get('sf_test')) { header('HTTP/1.0 500 Internal Server Error'); // clean current output buffer while (@ob_end_clean()) { } ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : ''); } // send an error 500 if not in debug mode if (!sfConfig::get('sf_debug')) { error_log($exception->getMessage()); $file = sfConfig::get('sf_web_dir') . '/errors/error500.php'; include is_readable($file) ? $file : sfConfig::get('sf_symfony_data_dir') . '/web/errors/error500.php'; if (!sfConfig::get('sf_test')) { exit(1); } return; } $message = null !== $exception->getMessage() ? $exception->getMessage() : 'n/a'; $name = get_class($exception); $format = 0 == strncasecmp(PHP_SAPI, 'cli', 3) ? 'plain' : 'html'; $traces = $this->getTraces($exception, $format); // extract error reference from message $error_reference = ''; if (preg_match('/\\[(err\\d+)\\]/', $message, $matches)) { $error_reference = $matches[1]; } // dump main objects values $sf_settings = ''; $settingsTable = $requestTable = $responseTable = $globalsTable = ''; if (class_exists('sfContext', false) && sfContext::hasInstance()) { $context = sfContext::getInstance(); $settingsTable = $this->formatArrayAsHtml(sfDebug::settingsAsArray()); $requestTable = $this->formatArrayAsHtml(sfDebug::requestAsArray($context->getRequest())); $responseTable = $this->formatArrayAsHtml(sfDebug::responseAsArray($context->getResponse())); $globalsTable = $this->formatArrayAsHtml(sfDebug::globalsAsArray()); } include sfConfig::get('sf_symfony_data_dir') . '/data/exception.' . ($format == 'html' ? 'php' : 'txt'); // if test, do not exit if (!sfConfig::get('sf_test')) { exit(1); } }
/** * Persists this object to the database. * * If the object is new, it inserts it; otherwise an update is performed. * All modified related objects will also be persisted in the doSave() * method. This method wraps all precipitate database operations in a * single transaction. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see doSave() */ public function save(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(PcContactNotePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); $isInsert = $this->isNew(); try { $ret = $this->preSave($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BasePcContactNote:save:pre') as $callable) { if (is_integer($affectedRows = call_user_func($callable, $this, $con))) { $con->commit(); return $affectedRows; } } // symfony_timestampable behavior if ($this->isModified() && !$this->isColumnModified(PcContactNotePeer::UPDATED_AT)) { $this->setUpdatedAt(time()); } if ($isInsert) { $ret = $ret && $this->preInsert($con); // symfony_timestampable behavior if (!$this->isColumnModified(PcContactNotePeer::CREATED_AT)) { $this->setCreatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); } if ($ret) { $affectedRows = $this->doSave($con); if ($isInsert) { $this->postInsert($con); } else { $this->postUpdate($con); } $this->postSave($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BasePcContactNote:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } PcContactNotePeer::addInstanceToPool($this); } else { $affectedRows = 0; } $con->commit(); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } }
/** * Selects a collection of {@link Product} objects with a {@link ProductI18n} translation populated. * * @param Criteria $criteria * @param string $culture * @param PropelPDO $con * @param string $join_behavior * * @return array */ public static function doSelectWithI18n(Criteria $criteria, $culture = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; if (null === $culture) { $culture = sfPropel::getDefaultCulture(); } // Set the correct dbName if it has not been overridden if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } ProductPeer::addSelectColumns($criteria); $startcol = ProductPeer::NUM_COLUMNS - ProductPeer::NUM_LAZY_LOAD_COLUMNS; ProductI18nPeer::addSelectColumns($criteria); $criteria->addJoin(ProductPeer::ID, ProductI18nPeer::ID, $join_behavior); $criteria->add(ProductI18nPeer::CULTURE, $culture); foreach (sfMixer::getCallables('BaseProduct:doSelectJoin:doSelectJoin') as $sf_hook) { call_user_func($sf_hook, 'Product', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = ProductPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = ProductPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = ProductPeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); ProductPeer::addInstanceToPool($obj1, $key1); } // if $obj1 already loaded $key2 = ProductI18nPeer::getPrimaryKeyHashFromRow($row, $startcol); if ($key2 !== null) { $obj2 = ProductI18nPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = ProductI18nPeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol); ProductI18nPeer::addInstanceToPool($obj2, $key2); } // if obj2 already loaded $obj1->setTranslationForCulture($obj2, $culture); } // if joined row was not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }