symfony1

Can't change model builder options

情到浓时终转凉″ 提交于 2019-11-30 15:46:14
I'm trying to get symfony to use a custom class called jsDoctrineRecord instead of sfDoctrineRecord for its models. Here's the code for the overriding class: <?php abstract class jsDoctrineRecord extends sfDoctrineRecord { public function foo() { echo 'foo';exit; } } Here's what I have in config/ProjectConfiguration.class.php , per the instructions here : <?php require_once dirname(__FILE__).'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php'; sfCoreAutoload::register(); class ProjectConfiguration extends sfProjectConfiguration { public function setup() { $this->enablePlugins(

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

∥☆過路亽.° 提交于 2019-11-30 15:16:28
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. As for the custom library part of the question, you might probably want to put your external library into the lib/vendor folder. Since symfony doesn't automatically load everything

Email body in Symfony 1.4 mailer?

◇◆丶佛笑我妖孽 提交于 2019-11-30 10:46:40
I'm using the Symfony 1.4 mailer where I build the various bits needed for an email and then send it out using: $this->getMailer()->composeAndSend($sender, $recipient, $subject, $body); In the email body, I need to able to take advantage of variables generated in the action, so right now I might have this in my action: $body = 'Your username is '.$username.' and this is the email body.'; Does anyone know of an elegant way of storing/organising various email bodies, instead of having to code them like this straight into my action? I will have many email templates and will also have them in

Symfony 1.4: Custom error message for CSRF in forms

99封情书 提交于 2019-11-30 09:27:26
Can anyone tell me where/how to customise the CSRF token error message for forms in Symfony 1.4. I'm using sfDoctrineGuard for logins and in this form particularly, whenever a session runs out and you still have the page open, it throws a very user-unfriendly error: "CSRF attack detected". Something like "This session has expired. Please return to the home page and try again" sounds better. What's the right way to do this in the form class? Thanks. The only way seems to be to overwrite sfForm::addCSRFProtection() . In /lib/form/BaseForm.class.php you can add this piece of code: class BaseForm

Easy to use/learn PHP framework? [closed]

只愿长相守 提交于 2019-11-30 07:34:42
I need to build a php app, and I was thinking about using a framework (never used one before). I've been browsing around some but most of them seems kinda complicated, I really liked what I saw about Symfony, but it looks like I will have to spend like a month until I really understand how to use it, and in one month I could code the app I have in mind 5 times without a framework. But I want to use one to "standardize" my code and prevent bugs. So I was wondering if someone could share with me which php frameworks you think are easier to learn how to use. My application will use mysql, and it

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

symfony 1.4 propel:build-all not working on Mysql 5.5

大城市里の小女人 提交于 2019-11-30 06:46:18
i am using Symfony 1.4.8 and Mysql 5.5 i got this error when i run symfony propel:build-all You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Type=InnoDB’ at line 1 1 Fixed the issue. It seems that in the DDL, you can’t say “Type=InnoDB|MyISAM|Foo” anymore. You have to say “Engine=InnoDB|MyISAM” so edit one file symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder /sql/mysql/MysqlDDLBuilder.php Line 156, change it as follows:- $script .= “Engine=$mysqlTableType”; A good

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 dynamic subdomains

爷,独闯天下 提交于 2019-11-30 05:08:46
I'm trying to match subdomains to a customer id in symfony. i.e. i have customer1.example.com and customer2.example.com Domains are stored in a table. When a user goes to customer1.example.com, I would like to get the subdomain, look up the domain name in the database, once matched, it will then deploy the app config for that customer and then store the customer_Id in a global attribute so i know exactly which customer I'm dealing with througout the whole application. The virtual host will have the relevant wildcard servername. Have you managed to achieve this, and if so, how? If not, any