本文整理汇总了PHP中sfMixer::getCallables方法的典型用法代码示例。如果您正苦于以下问题:PHP sfMixer::getCallables方法的具体用法?PHP sfMixer::getCallables怎么用?PHP sfMixer::getCallables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfMixer
的用法示例。
在下文中一共展示了sfMixer::getCallables方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeApprove
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);
}
示例2: newSfGuardConnectionHook
/**
*
* @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);
}
}
}
示例3: executeAnonymousComment
/**
* 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');
}
示例4: doCount
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;
}
示例5: doSelectJoinAllExceptUser
/**
* 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;
}
示例6: doSelectJoinAllExceptEspecialidad
/**
* 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();
//.........这里部分代码省略.........
示例7: isTaggable
/**
* 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;
}
示例8: save
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;
}
}
示例9: doSelectStmt
/**
* 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);
}
示例10: forward
/**
* 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 {
//.........这里部分代码省略.........
示例11: doSelectJoinAll
/**
* 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;
}
示例12: doSelectJoinAllExceptCiudadRelatedByIdCiudad
/**
* 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;
}
示例13: doSelectJoinAllExceptLocalidad
/**
* 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;
}
示例14: save
/**
* 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;
}
}
示例15: doSelectJoinTopicAndForum
/**
* 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;
}