Okay, I came up with a ridiculous hack to get this working. I simply wanted to be able to run the "load-data" and "build-all" tasks. This page gives info about how to add sfContext to a task:
http://www.symfony-project.org/book/1_2/16-Application-Management-Tools So on my machine I opened up these two files: /usr/share/php/symfony/plugins/sfPropelPlugin/lib/task/ sfPropelBuilAllLoadTask.class.php /usr/share/php/symfony/plugins/sfPropelPlugin/lib/task/ sfPropelLoadTask.class.php And I added this to the top of the file: require_once('/var/www/apartments/config/ ProjectConfiguration.class.php'); $configuration = ProjectConfiguration::getApplicationConfiguration ('frontend', 'dev', true); sfContext::createInstance($configuration); That got the tasks to run. One hell of an ugly hack. I hate editing core files. I feel like there should always be a solution to every problem that doesn't involve editing core fles. On May 17, 12:41 am, nick <[email protected]> wrote: > I'm using Symfony 1.2.7. I'm using Propel as the ORM. I would like to > be able to run this command: > > symfony propel:build-all-load > > I try to run this and I get the error: > > The "default" context does not exist. > > I look around on Google and there are dozens of mentions of this > error, such as this discussion on the forum: > > http://forum.symfony-project.org/index.php/t/15101/ > > Apparently the problem is the sfContext() > > Here, Jonathon Wage suggests not using the current context in model > classes: > > http://groups.google.com/group/symfony-devs/msg/52ffa70b40d5f44d > > Here Fabien Potencier responds to an old post about this problem, and > > he writes: > > "One of the main goal of the configuration refactoring was to be able > to use all symfony tools without initializing a sfContext object." > > However, I face a problem. sfContext is used in several plugins, and > in dozens of places in the code. It shows up in the base classes > generated by Propel. If I were to try to comment out the line that is > cause the trouble, I would hardly know where to start. Consider how > many times this appears. Suppose I change directory so that I'm in the > symfony project directory, and then I run this command: > > grep -R sfContext * > > I get: > > apps/frontend/lib/myUser.class.php: sfContext::getInstance()- > > >getConfiguration()->loadHelpers('Privacy'); > > lib/model/om/BaseApartmentInterestredRentPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentRentPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentCategoryPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentDraftAnswerPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentUserTypePeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentWaitListPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentAffiliateInPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentUserPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentPrizeTypePeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentAnswerTypePeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentUserProfileImagePeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentAuditTrailPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentAnswerStatusPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentPasswordResetPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentPrivacySettingPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentAffiliateOutPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentPaymentTypePeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentPriorityPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentPaymentStatusPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentUserStatusPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentInterestredAnswerPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentFeaturedRentPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentFeatureTypePeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentFeatureStatusPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentAnswerPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentVotesPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentInterestredUserPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentRentTypePeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentPrivacyEntityPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentRentStatusPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentCategoryImagePeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentImagePeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentDraftRentPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentUserTransactionPeer.php: $request = > sfContext::getInstance()->getRequest(); > lib/model/om/BaseApartmentUserTransactionTypePeer.php: $request > = sfContext::getInstance()->getRequest(); > lib/model/ApartmentRent.php: $this->setPaymentInfo > (sfContext::getInstance()->getUser()->getGuardUser()->getApartmentUser > ()->getEmail()); > > lib/form/ApartmentRentForm.class.php: $object->setUserId > (sfContext::getInstance()->getUser()->getGuardUser()->getApartmentUser > ()->getId()); > lib/form/ApartmentAnswerForm.class.php: $object->setUserId > (sfContext::getInstance()->getUser()->getGuardUser()->getApartmentUser > ()->getId()); > > plugins/sfGuardPlugin/lib/model/om/ > BasesfGuardUserPermissionPeer.php: $request = > sfContext::getInstance()->getRequest(); > plugins/sfGuardPlugin/lib/model/om/ > BasesfGuardRememberKeyPeer.php: $request = > sfContext::getInstance()->getRequest(); > plugins/sfGuardPlugin/lib/model/om/ > BasesfGuardGroupPermissionPeer.php: $request = > sfContext::getInstance()->getRequest(); > plugins/sfGuardPlugin/lib/model/om/ > BasesfGuardPermissionPeer.php: $request = sfContext::getInstance > ()->getRequest(); > plugins/sfGuardPlugin/lib/model/om/ > BasesfGuardUserGroupPeer.php: $request = sfContext::getInstance > ()->getRequest(); > plugins/sfGuardPlugin/lib/model/om/BasesfGuardGroupPeer.php: > $request = sfContext::getInstance()->getRequest(); > plugins/sfGuardPlugin/lib/model/om/BasesfGuardUserPeer.php: > $request = sfContext::getInstance()->getRequest(); > > plugins/sfGuardPlugin/lib/user/sfGuardSecurityUser.class.php: > sfContext::getInstance()->getResponse()->setCookie($remember_cookie, > $key, time() + $expiration_age); > plugins/sfGuardPlugin/lib/user/sfGuardSecurityUser.class.php: > sfContext::getInstance()->getResponse()->setCookie($remember_cookie, > '', time() - $expiration_age); > > plugins/sfPropelActAsCommentableBehaviorPlugin/lib/model/om/ > BasesfCommentPeer.php: $request = > sfContext::getInstance()->getRequest(); > > plugins/sfPropelActAsCommentableBehaviorPlugin/lib/form/ > sfCommentingForm.class.php: $config = > sfContext::getInstance()->getUser()->isAuthenticated() ? $config['user'] : > $config > > ['anonymous']; > plugins/sfPropelActAsCommentableBehaviorPlugin/lib/form/ > sfCommentingForm.class.php: if > (sfContext::getInstance()->getUser()->isAuthenticated()) > > plugins/sfPropelActAsCommentableBehaviorPlugin/lib/form/ > sfCommentingForm.class.php: $comment['author_id'] = > sfContext::getInstance()->getUser()->$id_method(); > plugins/sfPropelActAsCommentableBehaviorPlugin/lib/ > sfPropelActAsCommentableToolkit.class.php: $session = > sfContext::getInstance()->getUser(); > plugins/sfPropelActAsCommentableBehaviorPlugin/lib/ > sfPropelActAsCommentableToolkit.class.php: return > sfContext::getInstance()->getLogger()->log($e->getMessage()); > plugins/sfPropelActAsCommentableBehaviorPlugin/lib/ > sfPropelActAsCommentableToolkit.class.php: $session = > sfContext::getInstance()->getUser(); > plugins/sfPropelActAsCommentableBehaviorPlugin/modules/sfComment/lib/ > BasesfCommentComponents.class.php: $config = sfContext::getInstance > ()->getUser()->isAuthenticated() ? $this->config_user : > $this->config_anonymous; > > plugins/sfPropelActAsCommentableBehaviorPlugin/modules/sfComment/lib/ > BasesfCommentComponents.class.php: > sfContext::getInstance()->getResponse()->addStylesheet('/sfPropelActAsCommentableBehaviorPlugin/ > > css/sf_comment', 'first'); > plugins/sfPropelActAsCommentableBehaviorPlugin/modules/sfComment/lib/ > BasesfCommentActions.class.php: if > (((sfContext::getInstance()->getUser()->isAuthenticated() > > plugins/sfPropelActAsCommentableBehaviorPlugin/README: > 'author_id' => sfContext::getInstance()->getUser()->getUserId() > > So, sfContext is in the sfPropelActAsCommentable plugin, and in > sfGuardPlugin and in the base classes. And sfGuard has some kind of > fixture file that loads. > > So how can I call > > symfony propel:build-all-load > > ???? > > How do other developers deal with this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
