symfony-1.4

symfony doctrine admin generator sort by virtual columns

我怕爱的太早我们不能终老 提交于 2019-12-23 03:28:33
问题 I'm working with the Symfony doctrine admin generator. I've added a couple of virtual columns as detailed on this page http://www.symfony-project.org/jobeet/1_4/Doctrine/en/12 What I want to be able to do is sort my list based on those virtual columns. http://redotheweb.com/2008/09/25/sorting-by-custom-column-in-the-symfony-admin-generator/ That is how to do it with the Propel plugin but that details the use of a "sort_method" configuration in the yaml generator file, no such configuration

How to simulate an error 500 in Symfony 1.4?

穿精又带淫゛_ 提交于 2019-12-22 18:16:08
问题 I created an error500.php file in web/errors/ and would now like to test it. I tried to put this line in one of my actions: $this->getResponse()->setStatusCode(500); Unfortunately it looks like it's ignored. Do you guys have any idea of what's happening here? I'm using Symfony 1.4. Edit: Firebug is telling me that the error is actually fired but the page is still loading afterwards. And I'm in the prod env. 回答1: I'm pretty sure throwing any exception should trigger the error page: throw new

How to include multiple php libraries in Symfony?

孤者浪人 提交于 2019-12-22 11:37:11
问题 so, I have some php files in my apps/myprogram/lib folder. e.g. apps/myprogram/lib/myLibA.class.php When I run in my modules/actions/ scripts, and try to use the functions in myLibA, I cannot. because symfony complains that the myLibA class is not defined. do I need to specify anywhere in the symfony framework that myLibA.class.php is a required library? 回答1: Symfony's autoloader looks by default for your classes in the top-level <project>/lib directory. Any file in that directory or below

Symfony 1.4: Storing an array in session with SetAttribute

戏子无情 提交于 2019-12-22 08:26:02
问题 I'm wondering if someone knows how to store an array into a user session? This is the method to store a single attribute: $this->getUser()->setAttribute('something', $something); And the documentation says: "User attributes can store any type of data (strings, arrays, and associative arrays)" ... but doesn't say anything more. The API documentation doesn't have a "SetAttributes" or something similarly obvious. Thank you. 回答1: Uh, as I'd written the question out, it became obvious: $something

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

风格不统一 提交于 2019-12-22 00:24:26
问题 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? 回答1: 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'));?> 回答2: Since

Rebuild model without loss data in MySQL for Symfony

这一生的挚爱 提交于 2019-12-21 20:22:38
问题 What is the best way to rebuild a model without loss data in MySQL for Symfony? What if I have a big site, and a lot of data in the database and I would like after six months to add few new fields to database? 回答1: You can use migration. Doctine manual Symfony task for migrations Slideshare presentation Slideshare presentation So you need write migrations, migrate, and build your models, forms, etc. 回答2: I suggest you use @denys281 for Symfony1.4 ....in Symfony2 however its VERY simple ...

symfony: setHttpHeader() doesn't work, header() does

旧巷老猫 提交于 2019-12-21 13:08:07
问题 I built a simple action in symfony which generates a PDF-file via wkhtmltopdf and outputs it to the browser. Here's the code: $response = $this->getResponse(); $response->setContentType('application/pdf'); $response->setHttpHeader('Content-Disposition', "attachment; filename=filename.pdf"); $response->setHttpHeader('Content-Length', filesize($file)); $response->sendHttpHeaders(); $response->setContent(file_get_contents($file)); return sfView::NONE; That works fine in my local development

How to format a getUpdatedAt() kind of date in Symfony?

隐身守侯 提交于 2019-12-21 04:54:10
问题 I'd like to change the formatting of a date in Symfony 1.4 The default one being: <?php echo $question->getUpdatedAt(); // Returns 2010-01-26 16:23:53 ?> I'd like my date to be formatted like so: 26/01/2010 - 16h23 I tried using the format_date helper DateHelper class. Unfortunately the API is rather empty (something really needs to be done about it.) Browsing the helper's source code, I found that a second argument, format, can be passed. I assumed it was using the same syntax as PHP's date

Effort required to go from Symfony 1.4 to Symfony 2.0

孤街醉人 提交于 2019-12-20 10:55:41
问题 I have a website written in Symfony 1.4. It was my first symfony website and the learning curve was a bit steep for me. It is a fairly complicated website, and I don't want to 'fix it' if its not broken. Having said that, since sf 1.4 is now legacy code, I will eventually want to port the site to sf 2.0. as a matter of fact, I am relaunching the site early next year, and I want to know if I might just as well bite the bullet and "port" the site from 1.4 to 2.0 in one go. So, I need to know

Symfony memory issues

一世执手 提交于 2019-12-20 06:14:18
问题 I'm having hard time with symfony and cpu/memory leak, i'm new to symfony i don't know if i'm messing any tips or techniques to overcome this problem. i'm hosting my current symfony project on a vps and it halts almost every other hour. I would like also to know the answers for these questions : when i execute a doctrine query using (fetchOne, fetchAll, execute) i get a lot of extra symfony stuff like table name and structure ... is there any way to get just the data ? what should i do to