symfony1

Session deletion in Symfony 1.4

依然范特西╮ 提交于 2019-12-03 08:36:36
How do I delete all session variables at once if they are not in Array? PS I set them this way: $this->getUser()->setAttribute('PayPalTransaction.hash', $request->getParameter('hash')); Regards, Roman The sfUser class (which you get with $this->getUser() ), keeps all it's attributes in a sfNamespacedParameterHolder . So the setAttribute() function on sfUser if merely a proxy to the sfNamespacedParameterHolder::setAttribute() . You can get the reference to this holder with sfUser::getAttributeHolder() . The sfNamespacedParameterHolder also has a function clear() , which clears all attributes.

Clearing Symfony cache for another application

纵饮孤独 提交于 2019-12-03 08:18:30
I would like to clear my frontend application's cache from an action in my backend application. How can I achieve this? I believe the proper way to do this in symfony 1.2 is as follows: sfContext::switchTo('frontend'); //switch to the environment you wish to clear sfContext::getInstance()->getViewCacheManager()->getCache()->clean(sfCache::ALL); sfContext::switchTo('backend'); //switch back to the environment you started from This works for me. It removes all cached files from the given directory: $cache_dir = sfConfig::get('sf_cache_dir').'/'.$app.'/'.$env.'/'; $cache = new sfFileCache(array(

Overriding Doctrine_Record (sfDoctrineRecord) instance methods in Doctrine PHP Symfony

让人想犯罪 __ 提交于 2019-12-03 07:49:24
My background is in Propel, so I was hoping it would be a simple thing to override a magical getter in a Doctrine_Record (sfDoctrineRecord), but I'm getting either a Segfault or the override method is simply ignored in favor of the one in the superclass. https://gist.github.com/697008eaf4d7b606286a class FaqCategory extends BaseFaqCategory { public function __toString() { return $this->getCategory(); } // doesn't work // override getDisplayName to fall back to category name if getDisplayName doesn't exist public function getDisplayName() { // also tried parent::getDisplayName() but got

Is Symfony a better choice than Zend for a web development shop (10+) because it is a full stack framework? [closed]

删除回忆录丶 提交于 2019-12-03 07:48:35
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . My team at work is considering to use a framework for developing web sites and applications. Some of the seniors are convinced we should use the Zend Framework because it is easier to pick-and-choose the features so the framework we will be light-weight. I'm afraid however

Configure symfony project for Multiple Domains

半腔热情 提交于 2019-12-03 07:42:24
We have a product developed in PHP Symfony framework. We have couple of clients right now for whom we are maintaining different code base and databases (MySql). They access their respective code base using subdomain like client1.myproduct.com and client2.myproduct.com Now we want to make a single code base for both the clients and only keep files which are different (in terms of logic) for both of them in separate subdomains. So both the subdomains will point to the same code base but will access files from their respective subdomains whenever required i.e. whenever logic is different for some

How to set different template layout for different modules in Symfony

限于喜欢 提交于 2019-12-03 07:10:12
问题 How to set different template layouts for different modules in Symfony? I have a banking application that consists of a login screen, and a member section. So when a user goes to my site he will be presented with a login screen. After login in he will be redirected to the member section that he can do his whatever banking needs. So, how to set different layouts for the login screen and the pages inside the member section? Symfony seems to use frontend/templates/layout.php as the template for

How to create a custom yaml config file in Symfony

99封情书 提交于 2019-12-03 06:59:50
问题 What I want to do is quite simple: store data in a custom config file that I want to read later on. I created my file something.yml that I put in the global config directory. It looks like that: prod: test: ok dev: test: ko all: foo: bar john: doe Then I copied the config_handlers.yml and also put it in the config directory and added the following at the top of the file: config/something.yml: class: sfDefineEnvironmentConfigHandler param: prefix: something_ But if I'm calling sfConfig::get(

How to implement a helper in Symfony 1.4?

ⅰ亾dé卋堺 提交于 2019-12-03 05:51:01
问题 I'd like to create my own helper but can't find any help on Google for Symfony 1.4/Doctrine. I guess it has something to do with creating a myClassHelper.class.php in lib/helpers/ or something, but I don't know what to implement, or if specific methods have to be overridden. Any help would be appreciated! 回答1: I don't think that anything changed regarding the helpers in 1.4. From the documentation(although 1.2): Helper functions (regular PHP functions returning HTML code) should be saved in a

Sending an HTML email using Swift

萝らか妹 提交于 2019-12-03 05:44:10
I would like to send an auto-generated email with HTML body from my application using Swift. Here is my current code: $message = Swift_Message::newInstance() ->setFrom(array('dummy1@test.com' => 'John Doe')) ->setTo('dymmy2@test.com') ->setSubject('some subject'); $message->setBody($this->getPartial('global/mail_partial')); $this->getMailer()->send($message); I had already tried to change the header Content-type of the email message using some specific Swift methods but it is not working. Sarfraz See: Sending a HTML E-Mail (from SwiftMailer Docs) You need to add this line to set html content

combine symfony1 and Symfony2 projects

泪湿孤枕 提交于 2019-12-03 04:51:32
There is an existing website developed in symfony1.0 (propel as ORM). I have developed a module in Symfony2 (Doctrine2 as ORM) for the website. Both have authentication. New module should use members from existing database. Session between them should not be broken. What steps should I follow? How to handle this? I think you should create a custom user provider in your Symfony2 project to be able to share the users between two projects (but first check if you could use the doctrine user provider ). You should also implement a custom authentication provider to automatically log user in in the