symfony-1.4

Send attachment/Download file from Symfony action

南笙酒味 提交于 2019-12-24 07:58:27
问题 I'm trying to deliver a CSV file through an action. The mime-type in the response still shows as text/html. Can someone help? Thanks //$this->setLayout(false); //$this->getUser()->shutdown(); //sfConfig::set('sf_web_debug', false); $response = $this->getContext()->getResponse(); $response = $this->getResponse(); $response->clearHttpHeaders(); $response->setHttpheader('Pragma: public', true); $response->addCacheControlHttpHeader('Cache-Control', 'must-revalidate'); $response->setContentType(

symfony i18n objects without output escaping

不打扰是莪最后的温柔 提交于 2019-12-24 07:03:04
问题 I am having a problem in Symfony 1.4 and Doctrine with getting the value of an i18n object without output escaping. Typically I just do this $object->getDescription(ESC_RAW); to get the value un-escaped. The problem comes in when I want to get a specific translation of the object. How do I specify the culture and the escaping strategy? I haven't found any documentation on this. Can I pass multiple parameters as an array or something similar to this: $object->getDescription(array('fr', ESC_RAW

Symfony - updating unique column - validation problem

与世无争的帅哥 提交于 2019-12-24 00:47:01
问题 I'm new to Symfony Framework and I ran into a problem with form validation. I want to update data in DB including unique column, but if unique column is unchanged, an error is returned (An object with the same "domain" already exist."). Domain column must be unique, but user should be able to change it. So, if one user saves his domain name, no one else can use it, but he can change it in future. It seems like form validation compares unique column not only to other rows, but to itself too.

doctrine how to write WhereIn() with another sql query inside

一笑奈何 提交于 2019-12-24 00:12:32
问题 i have the folowing query in SQL ... where group_id IN (select group_id from alert where monitor_id = 4); I want to write it in Doctrine but i don't know how to add the IN select into WHEREIN() clause ! any idea ? this is what i did $q = $this->createQuery('u') ->select('u.email_address') ->distinct(true) // ->from('sf_guard_user u') ->innerJoin('u.sfGuardUserGroup ug') ->where('ug.group_id IN(select group_id from alert where monitor_id=?',$monitor); $q->execute(); In the sfGuardUserTable

Symfony Admin Generator Doctrine executeCreate

不问归期 提交于 2019-12-23 12:44:42
问题 Thanks for any help with this, I'm very new to the Symfony framework so just trying to get my head around it. I want to be able to intercept a submitted form from the admin area and modify the data. Here's what I've got so far (in basic form).. /apps/backend/modules/proposition/actions/action.class.php class propositionActions extends autoPropositionActions { public function executeCreate(sfWebRequest $request) { // modify the name $name = $request->getParameter('name'); $name = $name . ' is

How to download a file on clicking thefile path using PHP-Symfony?

99封情书 提交于 2019-12-23 05:58:11
问题 I'm creating a website using symfony for blogging. Users can upload their posts to the site. when a user add a file it will save inside web/upload/file_upload and the file path will save in add_post table. When a admin view a add_post table template he can see the path of the downloaded file of each and every user, what i want to do is through this file path download the file. How can i do this? edit 1: Model - Blog_user Module - post Table Structre - table name- Blog_user 1 user_id bigint(20

symfony 1.4 using post validator in New action throws error

你。 提交于 2019-12-23 05:09:25
问题 I have the following action for a form. In the MyForm definition, I added post validator, so I can validate two fields at a time by certain condition. The problem comes when, after passing validation, symfony sends me an error, and also stores null values in a new record in the database. I post my code here... My form just has two fields, and the user most select each of them from two lists to create a new record. By schema restrictions, the combination of both fields is unique. Also, I need

nestedSet - parent/child nodes

对着背影说爱祢 提交于 2019-12-23 04:53:33
问题 I am currently working on outputting a heirarchy in terms of a navigation menu from a nestedSet in Doctrine. I have a number of parents that then have several children. At the moment in time, there are only 2 levels: Parent and Child (no grandchildren). I have the following code: //actions: public function executeShow(sfWebRequest $request) { $this->tree = Doctrine::getTable('Model')->getMenuTree(); } //lib: class ModelTable extends Doctrine_Table { /** * Gets tree element in one query */

Use of Propel's addMultipleJoin

烈酒焚心 提交于 2019-12-23 04:41:31
问题 Following on from a previous question about sub-selects, I have an SQL statement with multiple criteria on the join, like so: SELECT * FROM person LEFT OUTER JOIN group_membership ON person.id = group_membership.person_id AND group_id = 1 WHERE group_membership.person_id is null; Unfortunately, Propel, the ORM I am using with Symfony, doesn't seem very adept using multiple joins, and previous people have tried to hack criteria together to achieve results. Doing this confused Propel, and it

Use of Propel's addMultipleJoin

寵の児 提交于 2019-12-23 04:41:04
问题 Following on from a previous question about sub-selects, I have an SQL statement with multiple criteria on the join, like so: SELECT * FROM person LEFT OUTER JOIN group_membership ON person.id = group_membership.person_id AND group_id = 1 WHERE group_membership.person_id is null; Unfortunately, Propel, the ORM I am using with Symfony, doesn't seem very adept using multiple joins, and previous people have tried to hack criteria together to achieve results. Doing this confused Propel, and it