本文整理汇总了PHP中sfMixer类的典型用法代码示例。如果您正苦于以下问题:PHP sfMixer类的具体用法?PHP sfMixer怎么用?PHP sfMixer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfMixer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __call
function __call($method, $arguments)
{
$r = "before __call\n";
$r .= sfMixer::callMixins();
$r .= "after __call\n";
return $r;
}
开发者ID:sensorsix,项目名称:app,代码行数:7,代码来源:sfMixerTest.php
示例2: add
public static function add($class, $behaviors)
{
foreach ($behaviors as $name => $parameters) {
if (is_int($name)) {
// no parameters
$name = $parameters;
} else {
// register parameters
foreach ($parameters as $key => $value) {
sfConfig::set('propel_behavior_' . $name . '_' . $class . '_' . $key, $value);
}
}
if (!isset(self::$behaviors[$name])) {
throw new sfConfigurationException(sprintf('Propel behavior "%s" is not registered', $name));
}
// register hooks
foreach (self::$behaviors[$name]['hooks'] as $hook => $callables) {
foreach ($callables as $callable) {
sfMixer::register('Base' . $class . $hook, $callable);
}
}
// register new methods
foreach (self::$behaviors[$name]['methods'] as $callable) {
sfMixer::register('Base' . $class, $callable);
}
}
}
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:27,代码来源:sfPropelBehavior.class.php
示例3: init
public static function init()
{
if (self::$_started) {
return;
}
$redirection_conf = sfConfig::get('app_redirection_databases', null);
if ($redirection_conf === null) {
return;
}
//Iterate over the databases configurations.
foreach ($redirection_conf as $dbName => $dbOptions) {
//Check if there are any slaves servers configured.
if ($dbOptions['slaves'] === null) {
continue;
}
foreach ($dbOptions['slaves'] as &$slave) {
foreach ($slave as &$param) {
$param = sfConfigHandler::replaceConstants($param);
}
#Symfony uses 'username' but Propel expects 'user'.
$slave['user'] = $slave['username'];
unset($slave['username']);
}
self::$_slaveConfig[$dbName] = $dbOptions['slaves'];
//Check if there is any entity that maybe be redirected to the slave.
if ($dbOptions['entities'] === null) {
continue;
}
//Iterate over the entities.
foreach ($dbOptions['entities'] as $model => $options) {
$peerClass = "{$model}Peer";
//Check if the peer exits.
if (!class_exists($peerClass)) {
continue;
}
$doSelectStmtHook = "{$peerClass}:doSelectStmt:doSelectStmt";
$doCountHook = "{$peerClass}:doCount:doCount";
//Register the interceptor function on the peer hooks.
$interceptor = array('sfPropelRedirection', 'slaveConnection');
sfMixer::register($doSelectStmtHook, $interceptor);
sfMixer::register($doCountHook, $interceptor);
//Check if the peer has conditions in order to be redirected to the slave.
if (!isset($options['conditions'])) {
continue;
}
self::$_peerOptions[$peerClass]['conditions'] = $options['conditions'];
//If there are zero conditions then we don't need to check a gen_column.
if (!isset($options['gen_column'])) {
continue;
}
$columnName = strtolower($model) . '.' . strtoupper($options['gen_column']);
//Check if the gen column really exists in the model
if (!in_array($columnName, $peerClass::getFieldNames(BasePeer::TYPE_COLNAME))) {
continue;
}
self::$_peerOptions[$peerClass]['gen_column'] = $columnName;
}
}
self::$_started = true;
}
开发者ID:hnh12358,项目名称:symfony-plugins,代码行数:60,代码来源:sfPropelRedirection.class.php
示例4: 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);
}
开发者ID:sgrove,项目名称:cothinker,代码行数:32,代码来源:BasesfApprovableActions.class.php
示例5: 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);
}
}
}
开发者ID:vcgato29,项目名称:poff,代码行数:18,代码来源:sfFacebookConnect.class.php
示例6: launchTests
public function launchTests($object, $class)
{
$this->t->diag('Mixins via sfMixer');
sfMixer::register($class, array('myMixinTest', 'newMethod'));
$this->t->is($object->newMethod(), 'ok', '__call() accepts mixins via sfMixer');
try {
$object->nonexistantmethodname();
$this->t->fail('__call() throws an exception if the method does not exist as a mixin');
} catch (sfException $e) {
$this->t->pass('__call() throws an exception if the method does not exist as a mixin');
}
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:12,代码来源:sfMixerTest.class.php
示例7: isBookmarkable
/**
* Returns true if the passed model name is bookmarkable
*
* @author Xavier Lacot
* @param string $object_name
* @return boolean
*/
public static function isBookmarkable($model)
{
if (is_object($model)) {
$model = get_class($model);
}
if (!is_string($model)) {
throw new Exception('The param passed to the metod isBookmarkable must be either an object or a string.');
}
if (!class_exists($model)) {
throw new Exception(sprintf('Unknown class %s', $model));
}
$base_class = sprintf('Base%s', $model);
return !is_null(sfMixer::getCallable($base_class . ':getBookmarkableReferenceKey'));
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:21,代码来源:deppPropelActAsBookmarkableToolkit.class.php
示例8: isCountable
/**
* Returns true if the passed model name is countable
*
* @author Xavier Lacot
* @param string $object_name
* @return boolean
*/
public static function isCountable($model)
{
if (is_object($model)) {
$model = get_class($model);
}
if (!is_string($model)) {
throw new Exception('The param passed to the method isCountable must be a string.');
}
if (!class_exists($model)) {
throw new Exception(sprintf('Unknown class %s', $model));
}
$base_class = sprintf('Base%s', $model);
return !is_null(sfMixer::getCallable($base_class . ':incrementCounter'));
}
开发者ID:sgrove,项目名称:cothinker,代码行数:21,代码来源:sfPropelActAsCountableToolkit.class.php
示例9: __call
public function __call($name, $arguments)
{
if (strpos($name, 'get') === 0) {
$key = strtolower(preg_replace('/^get/', '', $name, 1));
return $this->storage->get($key);
//todo allow backfetching?
} elseif (strpos($name, 'set') === 0 && array_key_exists(0, $arguments)) {
$key = strtolower(preg_replace('/^set/', '', $name, 1));
return $this->storage->set($key, $arguments[0]);
// forgot the return here
} elseif (strpos($name, 'has') === 0) {
$key = strtolower(preg_replace('/^has/', '', $name, 1));
return $this->storage->has($key);
}
return sfMixer::callMixins();
// We're going to need mixin support
}
开发者ID:WIZARDISHUNGRY,项目名称:sfDomFeedPlugin,代码行数:17,代码来源:sfDomStorage.class.php
示例10: 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');
}
开发者ID:sgrove,项目名称:cothinker,代码行数:27,代码来源:BasesfCommentActions.class.php
示例11: 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;
}
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:36,代码来源:FormularioPeer.php
示例12: 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);
}
开发者ID:nestorfsandoval,项目名称:2012_pw2_tp2,代码行数:31,代码来源:BaseProveedorPeer.php
示例13: __call
/**
* Catches calls to virtual methods
*/
public function __call($name, $params)
{
// symfony_behaviors behavior
if ($callable = sfMixer::getCallable('BaseCountry:' . $name)) {
array_unshift($params, $this);
return call_user_func_array($callable, $params);
}
return parent::__call($name, $params);
}
开发者ID:homer6,项目名称:blank_altumo,代码行数:12,代码来源:BaseCountry.php
示例14: 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;
}
开发者ID:nestorfsandoval,项目名称:2012_pw2_tp2,代码行数:45,代码来源:BaseClientePeer.php
示例15: 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;
}
开发者ID:jorisros,项目名称:sfWidgetCKEditorPlugin,代码行数:61,代码来源:BaseGalleryImagePeer.php
示例16: doSelectJoinAllExceptFile
/**
* 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;
}
开发者ID:ratibus,项目名称:Crew,代码行数:99,代码来源:BaseStatusActionPeer.php
示例17: 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;
}
开发者ID:homer6,项目名称:blank_altumo,代码行数:63,代码来源:BaseSystemEventInstancePeer.php
示例18: printStackTrace
/**
* 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);
}
}
开发者ID:taryono,项目名称:school,代码行数:70,代码来源:sfException.class.php
示例19: doFind
//.........这里部分代码省略.........
if ($this->getWithClasses() || $this->getWithColumns()) {
$c = $this->prepareCompositeCriteria();
if (method_exists($this->peerClass, 'doSelectRS')) {
$resultSet = call_user_func(array($this->peerClass, 'doSelectRS'), $c, $this->getConnection());
$propelVersion = '1.2';
$nextFunction = 'next';
$nextParam = null;
} else {
$resultSet = call_user_func(array($this->peerClass, 'doSelectStmt'), $c, $this->getConnection());
$propelVersion = '1.3';
$nextFunction = 'fetch';
$nextParam = PDO::FETCH_NUM;
}
// Hydrate the objects based on the resultset
$omClass = call_user_func(array($this->peerClass, 'getOMClass'));
$cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
$objects = array();
$withObjs = array();
while ($row = $resultSet->{$nextFunction}($nextParam)) {
// First come the columns of the main class
$obj = new $cls();
if ($propelVersion == '1.2') {
$startCol = $obj->hydrate($resultSet, 1);
} else {
$startCol = $obj->hydrate($row, 0);
}
if ($this->culture) {
$obj->setCulture($this->culture);
}
// Then the related classes added by way of 'with'
$objectsInJoin = array($obj);
foreach ($this->getWithClasses() as $className) {
$withObj = new $className();
if ($propelVersion == '1.2') {
$startCol = $withObj->hydrate($resultSet, $startCol);
} else {
$startCol = $withObj->hydrate($row, $startCol);
}
// As we can be in a left join, there is a possibility that the hydrated related object is null
// In this case, we must not relate it to the main object
$isEmpty = true;
foreach ($withObj->toArray() as $value) {
if ($value !== null) {
$isEmpty = false;
}
}
if ($isEmpty) {
continue;
}
// initialize our object directory
if (!isset($withObjs[$className])) {
$withObjs[$className] = array();
}
// check if object is not already referenced in allObjects directory
$isNewObject = true;
foreach ($withObjs[$className] as $otherObject) {
if ($otherObject->getPrimaryKey() === $withObj->getPrimaryKey()) {
$isNewObject = false;
$withObj = $otherObject;
break;
}
}
if (strpos(get_class($withObj), 'I18n') !== false) {
sfPropelFinderUtils::relateI18nObjects($withObj, $objectsInJoin, $this->culture);
} else {
sfPropelFinderUtils::relateObjects($withObj, $objectsInJoin, $isNewObject);
}
$objectsInJoin[] = $withObj;
if ($isNewObject) {
$withObjs[$className][] = $withObj;
}
}
// Then the columns added one by one by way of 'withColumn'
foreach ($this->getWithColumns() as $alias => $column) {
// Additional columns are stored in the object, in a special 'namespace'
// see getColumn() for how to retrieve the value afterwards
// Using the third parameter of withColumn() as a type. defaults to $rs->get() (= $rs->getString())
$typedGetter = 'get' . ucfirst($column['type']);
if ($propelVersion == '1.2') {
$this->setColumn($obj, $alias, $resultSet->{$typedGetter}($startCol));
} else {
$this->setColumn($obj, $alias, $row[$startCol]);
}
$startCol++;
}
$objects[] = $obj;
}
// activate custom column getter if asColumns were added
if ($this->getWithColumns() && !sfMixer::getCallable('Base' . $cls . ':getColumn')) {
sfMixer::register('Base' . $cls, array($this, 'getColumn'));
}
} else {
// No 'with', so we use the native Propel doSelect()
$objects = call_user_func(array($this->peerClass, 'doSelect'), $this->buildCriteria(), $this->getConnection());
}
if ($cache) {
$cache->set($key, $objects);
}
return $objects;
}
开发者ID:Zadkiel,项目名称:zadkiel_blog,代码行数:101,代码来源:sfPropelFinder.php
示例20: 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 j
|
请发表评论