symfony

Add widgets in forms

Hello I want to know if it's possible to add widgets to a CRUD form : I want to select an entry in a list or to enter a text in an input if the entry isn't in list. The user choose with a radiobutton if he choose in list or write in the input. It's possible ? If yes, how can I do this ? ...

symfony: sfDoctrineGuardPlugin: doesn't redirect to the referer page

Hi, I have just crate a new sf 1.3 project, installed sfDGP and activated the security on my web app so when i write an URL the authentication form appears. The problem: after logging the web app is not redirected to the referrer URL but to the root URL. These are my steps: I call the URL "http://rs3.localhost/frontend_dev.php/usuar...

How do I give Symfony templates a CSS class based on their navigation path

I am trying to render templates in Symfony with a CSS class to denote which part of the site they belong to. For example: I am in /games I'd like the page to look something like: <div id="wrapper" class="games"> <!-- content --> </div> Or if we are displaying /home/profile the page would look like this: <div id="wrapper" class="home...

'Invalid' error for sfWidgetFormChoice when form is submitted.

Hi, i want to display combo box using symfony. In the CountryForm.php i have created widget as : $this->setWidgets(array('country' => new sfWidgetFormChoice(array('choices' => array())))); for this validator as: $this->setValidators(array('country' => new sfValidatorChoice(array('choices' => array(array_keys($countries)))))); I am ge...

Form : sfWidgetFormDoctrineChoice, choose the method

Hello, In my form I want to use a widget Doctrine, but I can't change the method use to display the result of the doctrine query. I have make a function in my model : public function quartiers() { return $this->getQuartier(); } And in MyClassForm : $this->widgetSchema['list_quartiers'] = new sfWidgetFormDoctrineChoice(array('mode...

Symfony routing problem, route being ignored

I have the following in my app/frontend/config/routing.yml homepage: url: / param: { module: main, action: index } default_index: url: /:module param: { action: index } default: url: /:module/:action/* sf_guard_register: url: /register param: { module: user, action: register } sf_guard_signin: url: /login ...

Difference between the results of Doctrine_Query and Doctrine_RawSql

Hey I have problem with the following Doctrine_RawSql: public function getWithThreads($forum_id) { $conn = Doctrine_Manager::connection(); $q = new Doctrine_RawSql($conn); $q->select('{f.*},{t.*}, {p.id}, {p.last_post_date} ') ->from(sprintf("forum f LEFT JOIN thread t ON t.forum_id = f.id JOIN (SELECT MAX(p.crea...

Running symfony unit test returns "There is no open connection"

Symfony seems to have a problem opening a database connection while running unit test. I have my test env specified in config/databases.yml: all: doctrine: class: sfDoctrineDatabase param: dsn: 'mysql:host=localhost;dbname=ms' username: ms password: xxx test: doctrine: class: sfDoctrineDatabase par...

Modeling database : many small tables or not ?

Hello, I have a database with some information which are repeated in some tables. I want to know if it's interesting to create a table with this information and in the other table, I put only the id. It's interesting because with this method I haven't got redundance. But I will have to do many joints between my tables in my request, ...

Type casting of class variables in PHP/Symfony/Netbeans

Hello! Whenever I need to use the intelligence of Netbeans to show properties/methods, I explicitly declare a new object and then re-reference it. Something like.. $moo = new Cow(); $moo = Cow::getById(1); $hasMilk = $moo->hasMilk(); Is there a way I can avoid this by type-casting the variable when getting it? Or atleast a...

Webservices (wsdl) and phpunit

Hi, I have some needs, for a specific test type: I would like to check through phpunit tests, some webservices state, in a first time, and the file parsing, in a second. I use Symfony and SFphpunit plugin, but didn't find tools in phpunit library which can help me to do it. I'm write, or anyone has an answer? Thanks, Yan ...

Convert from Database / Excel / CSV to YAML data fixtures?

Was wondering if there is an easy to convert structured files into YAML data fixtures for Doctrine / Symfony. I don't see any utility with Doctrine to accept CSV. I might just start writing something simple to do this. Is it worthwhile? ...

DOMPDF 0.5.1 - new server environment breaks PDF output formatting

I'm using DOMPDF to generate PDFs inside of a symfony application. On my current production server, it works great. I was tasked with moving it to a new server. I checked out the code on the new server, and while it does generate a PDF still, most of the formatting is broken. Here's an example of what happens: http://geoffreymaddock....

distance_of_time_in_words gone crazy!

distance_of_time_in_words(strtotime(2010-08-07), strtotime(2010-08-01)) returns '6 minutes' $a = '2010-08-02 00:39:29' $b = '2010-08-01' distance_of_time_in_words($a, $b) returns 'less than a minute' $a = '2010-08-02 00:39:29' $b = '2010-08-01 20:08:00' distance_of_time_in_words($a, $b) returns 'less than a minute' I wonder if I...

Calculating an End Date

I need a bit of help using symfony to calculate an end date. The user will select a start date, a frequency (Ex. Every 7 Days, Every 14 Days, Every Month, Semi-Annually - Every 6 Months, etc), and the number of occurrences. Examples: Start date: 08/01/2010 Frequency: Every 7 days Occurrences: 4 End Date = 08/29/2010 Start date: 08/01/...

How to retrive array using Symfony $request->getParameter()

Html: <input type="checkbox" value="1" name="my_checkbox[]"> <input type="checkbox" value="2" name="my_checkbox[]"> <input type="checkbox" value="3" name="my_checkbox[]"> In action: $arr= $request->getParameter('my_checkbox[]'); this does not work. Any solution? ...

symfony : forms and primary keys

Hello, I have a form and when I want to set the primary key, I have an error 'Invalid' after the form's validation. My widget : $this->widgetSchema['nud'] = new sfWidgetFormInput(); And my validator : 'nud' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('nud')), 'empty_value' => $this->getObjec...

How to validate data for a Rest Service with symfony

For example imagine I've a rest service, this service takes two parameters : phone number text The goal is to send the message via a sms gateway. I've a class Message which has two properties destinationNumber and textMessage. Before calling the gateway, I want to validate the data received by the rest service. I've two questions r...

How do I save related objects in many to many relationships?

I have the following schema definition: Usuario: columns: empresa_id: { type: BIGINT, notnull: true } direccion_id: { type: BIGINT, notnull: false } publicidad_id: { type: BIGINT, notnull: true } tipo_id: { type: BIGINT, notnull: true } nombre: { type: string(60), notnull: true } paterno: { ty...

How to specify default order by clause in relations

comment: tableName: comments columns: comment_id: type: integer(4) primary: true notnull: true autoincrement: true news_feed_id: type: integer(4) relations: newsFeed: class: newsFeed local: news_feed_id foreign: news_feed_id foreignAlias: comments When I select new...