symfony-1.4

Why this schema is generating a relation n:m

99封情书 提交于 2019-12-04 05:56:43
问题 I've this schema.yml file (just relevant part): SdrivingMaquina: actAs: Timestampable: ~ columns: idmaquina: { type: integer(8), autoincrement: true, notnull: true, primary: true } idempresa: { type: integer(4), notnull: true } patente: { type: string(12), notnull: true } relations: Empresa: { local: idempresa, class: SdrivingEmpresa, type: one, foreignType: one, foreignAlias: MaquinaEmpresa, onDelete: CASCADE, onUpdate: CASCADE } SdrivingMaquinaEmisor: actAs: Timestampable: ~ columns:

Symfony - Is it possible to disable output escaping per module (or per template)?

心已入冬 提交于 2019-12-04 04:50:06
I'm trying to output some HTML in an XML template and Symfony's escaping method is messing it up. So I tried making a copy of settings.yml in the module's config folder, but it seems to be completely ignored. Is there an easy way to change the escaping_strategy and/or escaping_method settings per module or even per template? While output escaping is turned on you still have access to the raw value through $sf_data . For example, if the HTML you're trying to output was stored in a variable called html in your action: $this->html = '<b>My HTML</b>'; You could get the unescaped value with this: <

Execute custom SQL in symfony

為{幸葍}努か 提交于 2019-12-03 16:34:48
I'm trying to execute some custom SQL to retrieve some model objects in a Symfony application. I found a tutorial on the web that said something like this would allow me to execute the query although not populate the models (populating the model isn't a major issue, it's just for read only data). $pdo = Doctrine_Manager::getInstance()->connection()->getDbh(); $pdo->prepare("SELECT * from something complicated"); $pdo->execute(); $this->sensorReadings = $pdo->fetchAll(); But I'm getting an error : Fatal error: Call to undefined method PDO::execute() in sfproject/apps/frontend/modules/site

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

孤人 提交于 2019-12-03 14:29:29
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 function . But here's what it outputs (same example as above): <?php sfContext::getInstance()-

Session deletion in Symfony 1.4

依然范特西╮ 提交于 2019-12-03 08:36:36
How do I delete all session variables at once if they are not in Array? PS I set them this way: $this->getUser()->setAttribute('PayPalTransaction.hash', $request->getParameter('hash')); Regards, Roman The sfUser class (which you get with $this->getUser() ), keeps all it's attributes in a sfNamespacedParameterHolder . So the setAttribute() function on sfUser if merely a proxy to the sfNamespacedParameterHolder::setAttribute() . You can get the reference to this holder with sfUser::getAttributeHolder() . The sfNamespacedParameterHolder also has a function clear() , which clears all attributes.

Loading namespaced classes with Symfony 1.4's autoloader?

陌路散爱 提交于 2019-12-03 07:42:32
问题 How to register namespaces (with PHP 5.3) in the Symfony 1.4 for the autoloader class feature (like the Symfony 2.0)? 回答1: You can use Autoloader from Symfony2 in Symfony 1.4 framework. 1. Copy Symfony2 classloaders to vendor directory of your Symfony 1.4 sandbox project: SF_ROOT_DIR/lib/vendor/Symfony2/src/Symfony/Component/ClassLoader/UniversalClassLoader.php SF_ROOT_DIR/lib/vendor/Symfony2/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php 2. Modify your SF_ROOT_DIR/config

Symfony Multiple application interaction

倖福魔咒の 提交于 2019-12-03 07:00:39
In symfony 1.4, how to call an action of another application from the current action? There's a blog post about that here: http://symfony.com/blog/cross-application-links There's a plugin for it: https://github.com/rande/swCrossLinkApplicationPlugin And there are some blogposts explaining it: http://rabaix.net/en/articles/2009/05/30/cross-link-application-with-symfony http://rabaix.net/en/articles/2009/07/13/cross-link-application-with-symfony-part-2 (Note: both are for symfony 1.2, but they should also work in 1.4) To route to your frontend to your backend, there are three easy steps: 1. Add

How to create a custom yaml config file in Symfony

99封情书 提交于 2019-12-03 06:59:50
问题 What I want to do is quite simple: store data in a custom config file that I want to read later on. I created my file something.yml that I put in the global config directory. It looks like that: prod: test: ok dev: test: ko all: foo: bar john: doe Then I copied the config_handlers.yml and also put it in the config directory and added the following at the top of the file: config/something.yml: class: sfDefineEnvironmentConfigHandler param: prefix: something_ But if I'm calling sfConfig::get(

How to implement a helper in Symfony 1.4?

ⅰ亾dé卋堺 提交于 2019-12-03 05:51:01
问题 I'd like to create my own helper but can't find any help on Google for Symfony 1.4/Doctrine. I guess it has something to do with creating a myClassHelper.class.php in lib/helpers/ or something, but I don't know what to implement, or if specific methods have to be overridden. Any help would be appreciated! 回答1: I don't think that anything changed regarding the helpers in 1.4. From the documentation(although 1.2): Helper functions (regular PHP functions returning HTML code) should be saved in a

Loading namespaced classes with Symfony 1.4's autoloader?

亡梦爱人 提交于 2019-12-02 21:09:26
How to register namespaces (with PHP 5.3) in the Symfony 1.4 for the autoloader class feature (like the Symfony 2.0 )? You can use Autoloader from Symfony2 in Symfony 1.4 framework. 1. Copy Symfony2 classloaders to vendor directory of your Symfony 1.4 sandbox project: SF_ROOT_DIR/lib/vendor/Symfony2/src/Symfony/Component/ClassLoader/UniversalClassLoader.php SF_ROOT_DIR/lib/vendor/Symfony2/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php 2. Modify your SF_ROOT_DIR/config/ProjectConfiguration.class.php file as follows: require_once dirname(__FILE__) . '/../lib/vendor/symfony/lib