symfony-1.4

symfony 1.4: How to pass exception message to error.html.php?

匆匆过客 提交于 2019-11-30 07:34:25
I tried using special variable $message described here http://www.symfony-project.org/cookbook/1_2/en/error_templates but it seems this variable isn't defined in symfony 1.4, at least it doesn't contain message passed to exception this way throw new sfException('some message') Do you know other way to pass this message to error.html.php ? You'll need to do some custom error handling. We implemented a forward to a custom symfony action ourselves. Be cautious though, this action itself could be triggering an exception too, you need to take that into account. The following might be a good start.

Using routes to generate URLs in a Symfony task

纵饮孤独 提交于 2019-11-30 07:26:16
I am running Symfony 1.3.6 on Ubuntu 10.0.4 LTS. I have written a Symfony task that generates a report which contains links (URLs). Here is a snippet of the execute() method in my task class: protected function execute($arguments = array(), $options = array()) { //create a context sfContext::createInstance($this->configuration); sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'Asset', 'Tag')); ... $url = url_for("@foobar?cow=marymoo&id=42"); // Line 1 echo '<a href="'.$url.'">This is a test</a>'; // Line 2 echo link_to('This is a test', $url); } The route name is defined

Swift Mailer Delivery Status

故事扮演 提交于 2019-11-30 06:29:54
问题 Does anyone know if SwiftMailer send function returns delivery status? I would like to be able to know that email was delivered or not delivered.Is this possible? Thanks 回答1: There are at least three layers of checks that SwiftMailer supports, that will report several types of delivery failures. 1) Always check the return code from SwiftMailer's send() or batchSend() commands for a non-zero result. From the documentation: //Send the message $numSent = $mailer->send($message); printf("Sent %d

Symfony 1.4 using deprecated functions in php 5.5

夙愿已清 提交于 2019-11-30 03:18:05
I recently upgraded PHP from version 5.3.27 to 5.5.0. Everything is working fine in my Symfony 2.3.2 project, and I can enjoy the latest PHP functionalities. Now when I am going back to my other Symfony 1.4.16 project, I get a PHP error about preg_replace being deprecated with the /e modifier. I can find no reference about this error in the forums: Has anyone had this problem before ? Is there any kind of patch that I could apply out of the box ? Is an upgrade to Symfony 1.4.20 going to fix this issue ? The error message goes like this: Deprecated: preg_replace(): The /e modifier is deprecated

How to create/use custom classes and helper in symfony 1.4?

蓝咒 提交于 2019-11-29 21:45:15
问题 What is the best way to put custom library or helper methods in symfony? I am using doctrine with my project. One place I consider to put is under project_root/lib/vendor/MyClasses/ But if I want to create a class or helper function which will use some core symfony/doctrine methods and return a result then how to do that and where should I put it? I want it to call from different modules to avoid code duplication. 回答1: As for the custom library part of the question, you might probably want to

Using routes to generate URLs in a Symfony task

柔情痞子 提交于 2019-11-29 10:28:26
问题 I am running Symfony 1.3.6 on Ubuntu 10.0.4 LTS. I have written a Symfony task that generates a report which contains links (URLs). Here is a snippet of the execute() method in my task class: protected function execute($arguments = array(), $options = array()) { //create a context sfContext::createInstance($this->configuration); sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'Asset', 'Tag')); ... $url = url_for("@foobar?cow=marymoo&id=42"); // Line 1 echo '<a href="'.

MySQL User defined variable within Doctrine and Symfony

◇◆丶佛笑我妖孽 提交于 2019-11-29 07:59:46
I have the following Doctrine statement which works fine. $query = $this->createQuery('r') ->select('u.id, CONCAT(u.first_name, " ", LEFT(u.last_name,1)) as full_name, u.first_name, u.last_name, u.gender, r.run_time') ->innerJoin('r.ChallengeUser u') ->orderBy('run_time') ->execute(array(), Doctrine::HYDRATE_ARRAY_SHALLOW); I need to add a row count into this. Now I know with raw SQL you can do this; SET @rank=0; SELECT @rank:=@rank+1 as rank, u.id, u.first_name ....etc So my question is, how can I get this to run with Symfony 1.4 and Doctrine? I am using MySQL for this project. Edit... I

SQL query with UNION in Doctrine Symfony

笑着哭i 提交于 2019-11-29 02:31:47
I have a question about the translation of a SQL query in Doctrine Symfony. I would like to do a thing like that : SELECT m.* FROM member m INNER JOIN ( SELECT id_member FROM friend WHERE id_friend=99 UNION SELECT id_friend FROM friend WHERE id_member=99 ) a ON m.id=a.id_member WHERE m.visible=1 In this example, i search all friends of the user 99. My tables : Member: (id, name, visible) Friend: (id, id_member, id_friend, active) Precision : I would like to use the Symfony pager. A solution ? Thank you ! UNION is not supported within DQL, but you can issue your query using RAW SQL -> $q =

Symfony 1.4 using deprecated functions in php 5.5

扶醉桌前 提交于 2019-11-29 00:23:52
问题 I recently upgraded PHP from version 5.3.27 to 5.5.0. Everything is working fine in my Symfony 2.3.2 project, and I can enjoy the latest PHP functionalities. Now when I am going back to my other Symfony 1.4.16 project, I get a PHP error about preg_replace being deprecated with the /e modifier. I can find no reference about this error in the forums: Has anyone had this problem before ? Is there any kind of patch that I could apply out of the box ? Is an upgrade to Symfony 1.4.20 going to fix

Swift Mailer Delivery Status

て烟熏妆下的殇ゞ 提交于 2019-11-28 19:13:25
Does anyone know if SwiftMailer send function returns delivery status? I would like to be able to know that email was delivered or not delivered.Is this possible? Thanks There are at least three layers of checks that SwiftMailer supports, that will report several types of delivery failures. 1) Always check the return code from SwiftMailer's send() or batchSend() commands for a non-zero result. From the documentation : //Send the message $numSent = $mailer->send($message); printf("Sent %d messages\n", $numSent); /* Note that often that only the boolean equivalent of the return value is of