symfony

Cloud-aware programming and help choosing a good framework

How can i write a cloud-aware application? e.g. an application that takes benefit of being deployed on cloud. Is it same as an application that runs or a vps/dedicated server? if not then what are the differences? are there any design changes? What are the procedures that i need to take if i am to migrate an application to cloud-aware? ...

How do I sort an internationalized i18n table with symfony and doctrine?

I would like to display a list of records from an internationalized table using sfDoctrinePager. Not all the records have been translated to all the languages supported by the application, so I had to implement a fallback mechanism for some fields (by overriding the getFoo() function in the Bar.class.php, as explained in another post her...

Specific checkboxes checked in symfony 1.4

Hi, I'm able to do the following for all checkboxes in a set (in an action): $this->form->getWidget('some_form_field')->setAttribute('checked', 'checked'); ... but I'm unable to set specific checkboxes to ticked on the basis of data returned from the db. I'm after something like: $this->form->getWidget('some_form_field')->setAttrib...

Doctrine date in save override / before save

I have Doctrine model with a date field "date_of_birth" (symfony form date) which is filled in by the user all works 100% it saves to the db as expected, however in the model save() method I need to retrieve the value of this field before save occurs. My problem is that When trying to get the date value it returns empty string if its a n...

sfValidatorDoctrineChoice and i18n

I'm using Symfony 1.4.3 + Doctrine 1.2, and a typical i18n category table (the ids are in category, and the name and slug in category_translation). I have this Doctrine validator defined in my form: $this->setValidators(array( 'category' => new sfValidatorDoctrineChoice(array('model' => 'Category', 'column' => 'slug')), )); So,...

Symfony: Special routing for mobile browsers

Is there any way that I can detect browser type on routing and use specific controller? I want to be able to do something like this in routing.yml: mobile: url: /* requirements: browser: mobile ...

In Symfony, how can I add a 'selected' class to the currently selected page in my navigation?

My navigation is written in the layout.php template It looks like this: <ul id="nav"> <li><a href="item1">Item 1</a></li> <li><a href="item1">Item 2</a></li> <li><a href="item1">Item 3</a></li> <li><a href="item1">Item 4</a></li> </ul> What is the best way to get a class="current" on the currently selected page? ...

Hadoop application development, and PHP

For hadoop application development, are PHP frameworks less popular ?If so, why? Else,please do point literature/documentation/tutorials for a specific framework? (stuff for Symfony would be awesome!) ...

Symfony/Doctrine: Unserialize in action vs template

Hi, Can anyone tell me why calling "unserialize" works fine in an action but gives an offset error in a template? It's basically possible to unserialize a database text result into a variable in an action and pass it to template, in which case it displays fine: $this->clean = unserialize($this->raw); <?php echo $clean ?> But not if ...

Symfony 1.4: how to enable non-numerical IDs for routes in admin generator?

My model is built on non-numerical ID's (36-char. GUID to be specific). The problem is that when I run symfony 1.4 admin generator, it assumes that all my IDs are numeric and applies default routing requirements. I tried providing specific routing requirements as advised here: http://www.codemassacre.com/2009/04/27/symfony-12-admin-wit...

In symfony how to use template from another context, i.e. get frontend template from backend

It's need for preview function in backend. I want to avoid duplicating templates. // in some backend module action $this->setTemplate(sfConfig::get('sf_apps_dir').'/frontend/modules/module/templates/tpl'); because context is backend, how about partials in tpl, routes and so forth? ...

sfWidgetFormChoice rendered as an unordered list

Hello. I'm using symfony 1.4.3 Is there some way to render a sfWidgetFormChoice as an unordered list? In the API there is an option called 'renderer_class' but I can't find any documentation or example about it. Thanks! ...

What's the best way to customize / add pages to the admin generator?

I'm using Symfony 1.4 and Doctrine. My application's backend was built using Symfony's admin generator. It works great when I want to display basic stuff. But tehre's not a lot of documentation on how to enhance it and add new pages. Let's take an example: I want to list published items on one page and to-be-published items on another...

How to join a table in symfony (Propel) and retrieve object from both table with one query

Hi, I'm trying to get an easy way to fetch data from two joined Mysql table using Propel (inside Symfony) but in one query. Let's say I do this simple thing: $comment = CommentPeer::RetrieveByPk(1); print $comment->getArticle()->getTitle(); //Assuming the Article table is joined to the Comment table Symfony will call 2 queries to ge...

User accounts in Symfony?

I'm new to Symfony. Is my understanding correct that the User class is actually for controlling sessions? But is there built-in login and account creation? I'm not finding it. But if there's an admin backend generator, how can it function without user logins? ...

Symfony 1.3 and forms: the password changes when i click on 'Save', why??

Hi, i have installed sfDoctrineGuardUser and have created this model that inherits sfGuardUser model: Usuario: inheritance: extends: sfGuardUser type: simple columns: nombre_apellidos: string(60) sexo: boolean fecha_nac: date provincia: string(60) localidad: string(255) email_address: strin...

symfony sfValidatorSchemaCompare and dateformat output problem

public function configure() { $this->widgetSchema['start_date'] = new sfWidgetFormInput(); $this->widgetSchema['end_date'] = new sfWidgetFormInput(); $this->validatorSchema->setPostValidator( new sfValidatorOr ( array( new sfValidatorAnd( array ...

Symfony - Custom under maintenance page

Hi there! I'm trying to add a custom page to my web application for the times I'm performing maintenance. I'm trying to test the referred page on my development environment but always appear the symfony page. I had already created a module with a proper action and template and also configured those on the settings.yml file. Can anyone ...

Symfony 1.4: Programatically set environment for CLI

I have a project built on Symfony 1.4 and it has multiple environments - each developer has their own copy installed on their local machine and therefore has their own environment. I am able to dynamically set the environment in index.php, but how can I do this for CLI tasks? I could of course use --env=myenvironment on all tasks, but ...

How to create a custom yaml config file in Symfony

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 directo...