symfony

symfony module management

I have way too many modules in my application. Currently my modules are namespaced, but what I'd like to do is have a directory structure so I can get rid of this redundant and annoying namespacing. For instance, for modules named "xModule1, xModule2, xModule3", I'd like to have a directory structure like this: -x -module1 -acti...

Symfony sessions outside app?

Throughout our site we have a login button, whenever someone logs in the button changes into "log out" and the users name is displayed next to it. Our server setup uses Varnish so we devised a way where a bit of javascript does a POST and we check if the user is Authenticated. To avoid server overhead I thought it would be simple to jus...

Retrieving related data in the Symfony Admin Generator

I have a problem with the Admin Generator. The Table of Pages have the column sf_guard_user_id. The rest of the table looks as this part of the generator.yml in the line display, list: title: Pages display: [=title, sfGuardUser, views, state, privacy, created_at, updated_at] sort: [created_at, desc] fields: sfGu...

Symfony: Write Content to Head

Is there a reasonably elegant means of writing a simple block of JS to the head of a Symfony layout? I have a Page module whose showSuccess template is aware of how many widgets it has to display. I need to communicate that number to an external JS file included via use_javascript(). The only way I know to do it with any simplicity is t...

Where to look up design pattern of symfony ?

The official website seems only provided some tutorial on how to use: http://www.symfony-project.org But I want to know why the directories should be setup like this ...

Custom CSS classes for Symfony form labels?

Hi, Is there a simple way to declare CSS classes for Symfony form labels? This doesn't work: <?php echo $form['email']->renderLabel('class' => 'my-css') ?> Found this and it works but it feels counter-intuitive, as it makes the form labels themselves obsolete by requiring the label to be written out in the template: <?php echo $for...

Where do I look up in-depth tutorial for symfony 1.4?

I'm now reading this tutorial,which is pretty good because it not only tells you how but also why. http://www.symfony-project.org/book/1_2/10-Forms But it's based on symfony 1.0,is there such a good tutorial for the newest version of symfony? ...

Symfony + Doctrine - possible to link more than 2 tables/models together?

I've created an sfGuardUserProfile model that has a relation to the sfGuardUser model. Then I define another model with a relation to sfGuardUserProfile. I don't get any errors when I create the database, but when I try saving data to sfGuardUserProfile in my actions file, I get this error: SQLSTATE[23000]: Integrity constraint viola...

How to get the object with its translation using getRoute in Symfony?

I have several models with translations. When I load $this->tour = $this->getRoute()->getObject(); por example, it gets me the Tour Object. However, it doesn't join to the tour_translation table; so when after i try to get it's title; symfony makes another sql query. How I can override something, so in the Tour model when I ask for t...

How to implement a Symfony form with a many-to-many relationship?

Hi, I have three tables forming a many-to-many relationship. They are, WebUserRole -> WebUserRolePermission <- WebUserPermission I've just started doing the admin for my WebUserRole object (using the propel:generate-admin), and I want the form for the WebUserRole to list the permissions with a check box next to each. Now, is there a...

What's the default javascript library used in symfony 1.4?

I'm reading a tutorial for 1.2,which says prototype is the built in library : http://www.symfony-project.org/book/1_2/11-Ajax-Integration What about the newest version of symfony? I'm only familiar with jQuery,is there an easy way to replace the default by jQuery? ...

What does this kind of http header mean in symfony?

$this->getResponse()->addCacheControlHttpHeader('private=True'); What's that for,how does it work? ...

Generating data (using PHP) in a YML fixtures file

I want to generate test data for a fixture file. I wnat to generate the test data instead of having to type in hundreds of records. Assuming my schema is as shown below: foobar_department_def: _attributes: { phpName: Department } id: name: { type: varchar(64), required: true } foobar_qualification_def: ...

Converting '' to NULL in doctrine and symfony

Im using the symfony framework with mysql. I have a field in mysql that is generated by doctrine as: weight: { type: double, notnull: false, default: NULL } `weight` double(18,2) NULL DEFAULT NULL The value is entered using a textbox and the generated sql trys to insert '' into this field if no value is given. This produ...

Symfony: How to change a form field attribute in an action?

Hi, I've got a functioning form with a sfWidgetFormChoice that acts as a list of checkboxes. I'm able to set the checkboxes to "ticked" by default with the following: 'status' => new sfWidgetFormChoice(array('choices' => array(1, 2, 3), 'multiple' => true, 'expanded' => true), array('checked' => 'checked')) ... where the checkboxes a...

Email body in Symfony 1.4 mailer?

Hi, 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 = '...

How should components should add JavaScript and CSS in Symfony

Hello, My layout.php calls include_javascripts() before my componet could call sfResponse::addJavascript(). Is there a "helper" or a "best practice" to handle this? Do I have to Seperate the call sfResponse::addJavascript()? I were happy to avoid it. Here ist my actual workaround: <head> <?php $nav = get_component('nav', 'nav') /* P...

Symfony admin generator generated module has no style

I am using Symfony 1.31 for a brand new project. I have just created a module in the backend app, using the admin generator. To my suprise, it seems no theme ((At all) has been applied to the pages. As I mentioned before, this si abrand new project - I have not even modified the /app/backend/layout.php file yet. I rember having a simila...

Datagrid for Symfony?

I want to use a datagrid in one of my modules (Symfony 1.3, Propel ORM). I have spent a while searching the web, but everything I found expects a direct connection to teh db (mySQL) or is otherwise unsuitable. I found the datagrid plugin (http://symfony.swisscenter.com/datagrid/exemples), but the documentation/examples are in French - a...

Getting distance from given coordinates in doctrine geographical records

Hello everybody, I'm developing a Symfony 1.4 project where one of the tables has the Geographical template. The present functions can give the distance between two records, but not between records and given coordinates. How can be implemented such feature in Symfony way? More specific: I need the records ordered by descending distanc...