symfony1

Doctrine Subquery in InnerJoin

谁说胖子不能爱 提交于 2019-12-05 01:35:34
i have functional query in MySql: select t.won,e.etot, s.username,s.country,r.points,r.rank FROM sf_guard_user s INNER JOIN marks r ON r.user_id = s.id inner join (select t.user_id,count(t.user_id)as won from topper t group by t.user_id) t on t.user_id=s.id inner join (select e.user_id,count(e.user_id)as etot from exams e group by e.user_id) e on e.user_id=s.id ORDER BY r.rank asc i wrote doctrine code in sfGuardUserTable Class: $q= $this->createQuery('u'); $wq =$q->createSubquery() ->select('t.user_id,count(t.user_id) won') ->from('Topper t') ->groupBy('t.user_id'); $dq = $q->createSubquery()

Symfony 1.4 sessions randomly lost

Deadly 提交于 2019-12-05 01:10:11
This is an issue I've started to experiment a few months ago and I've been trying to fix without success since. Symptoms : At random intervals of time symfony loses the session info and logs out the users. It seems somehow to be connected with the load of the site. When the load is higher it seems that the users are logged out more often, could happen even fast as 30 seconds. Environment : Since this started I've changed a lot of the setup, including the php version, web server, session storage, symfony version. Here is the current setup: Ubuntu 10.04, php 5.4.0, symfony 1.4.17, nginx 1.0.15

How to define Assetic resources in Symfony 2 yml or xml configuration file?

雨燕双飞 提交于 2019-12-04 22:59:57
问题 Can you define assetic resource in configuration file (yml/xml)? Lets take jquery as example. I would like to have configuration like this: # app/config/config.yml assetic: resources: jquery: latest: "app/Resources/js/jquery-1.6.2.js" 1_6_2: "app/Resources/js/jquery-1.6.2.js" 1_5: "app/Resources/js/jquery-1.5.js" And to be able to access this resource from any template in my application something like this: {% javascripts 'jquery.latest' %} <script type="text/javascript" src="{{ asset_url }}"

Creating a rss feed in Symfony

人盡茶涼 提交于 2019-12-04 21:33:24
I'm trying to create a RSS feed in Symfony. I've added the following route : rss_every_content: url: /rss/all param: { module: content, action: index, sf_format: rss } requirements: sf_method: [get] And I created a file called indexSuccess.rss.php in module/content/templates/ : test message But when I go to the url mysite/rss, all I get is an empty page ! No content at all, not even the debug toolbar... Help ! What is going on ? OrganicPanda I had the same problem as you. I noticed that sf_format: xml with indexSuccess.xml.php seems to work as long as you specify the RSS XML tag at the top

How to internationalize metas such as title in view.yml?

我只是一个虾纸丫 提交于 2019-12-04 21:20:34
I'd like to internationalize the strings of my view.yml, I can't find how to do this. I have a solution that is bad, in my opinion: metas: title: <?php echo sfContext::getInstance()->getI18n()->__('TITLE'); ?> I'd like to find a way to do it without calling "sfConfig::getInstance()". Is it possible? Never ever use sfContext for I18n in Configuration-Files! In such a case use the setTitle function in the View (not the controller) <?php $sf_response->setTitle(__('TITLE'));?> Since include_title() does not translate what it finds in view.yml, I made this very simple function in my custom helper:

Lighttpd configuration, . (dots) in my query string cause 404

半城伤御伤魂 提交于 2019-12-04 20:14:01
I have an address on my site like so: http://www.example.com/lookup?q=http%3A%2F%2Fgigaom.com%2F2010%2F10%2F10%2Fangry-birds-for-windows7-phone-dont-count-on-it%2F In this example, the dot in the 'gigaom.com' part of the query string is screwing with lighttpd and my rewrite rules. I get a 404 with the dot in, no 404 if I take the dot out. My rewrite rules are below. In case it makes a difference, I'm using symfony 1.4. If anyone could shed some light on this problem it would be much appreciated! url.rewrite-once = ( "^/(.*\..+)$" => "$0", "^/(.*)\.(.*)" => "/index.php", "^/([^.]+)$" => "/index

Symfony (PHP framework) and MongoDB ( or any json-based database) [closed]

纵饮孤独 提交于 2019-12-04 20:09:38
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I was wondering if its possible to use a json-based schema-free, document-based database like Mongodb or Couchdb on a symfony project like its used for ruby-on-rails websites? And if yes, how can it be done? 回答1: There is a DoctrineMongoDBBundle for use with Symfony 2 回答2: You might get some help from the

Creating a Calendar in Symfony

纵饮孤独 提交于 2019-12-04 20:01:17
I'm using symfony 1.4 for my web project. I have the following problem (or opportunity): I need to create a calendar where the "common" user has only the ability to see (or read) the date and time of the events and the "admin" user can edit, add and remove new events. So it's basically a google calendar type of thing where I have to different permissions, read and read, write, delete. Also I need to be able to fully customize a calendar style so that It matches my css. How would your approach this problem? I've been trying to find the best plugin for this endeavor but I haven't found one that

Find current Doctrine database connection settings in symfony

允我心安 提交于 2019-12-04 18:45:12
问题 I need to know the database name and database server name inside a symfony project. How can one access the current database connection settings programmatically in symfony (using Doctrine)? 回答1: for example: foreach(Doctrine_Manager::getInstance()->getConnections() as $connection){ $conn = $connection->getOptions(); preg_match('/host=(.*);/', $conn['dsn'], $host); var_dump($host); } 回答2: Assuming you have the EntityManager as $this->em Get Doctrine Database Name from Symfony2: $this->em-

Work with app/console in Symfony at Mac OS X

本小妞迷上赌 提交于 2019-12-04 18:14:07
I've installed Symfony on Mac Os X and do: chmod -R 777 app/cache app/log Try do this: php app/console cache:clear And get back error: [RuntimeException] Unable to write in the "/Users/anton/Sites/local/Symfony/app/cache/dev" directory Try to fix it! Thanks! If you are on Mac you can use ACL as it is explained here . From the project directory: sudo chmod +a "_www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs sudo chmod +a "whoami allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs _www in the first line is the name of which is running