symfony-1.4

How do I access POST parameters in actions.class.php in symfony 1.4?

I'm still fairly new to symfony, so my apologies if this is a stupid question. I'm using symfony 1.4 with Doctrine. My colleague wrote a JavaScript to make a report from our client side widget to our server: $j.post(serverpath, {widget_id:widget_id, user_id:user_id, object_id:object_id, action_type:action_type, text_value:stuff_to_repor...

Symfony 1.4 - Updating hidden value when form is updated

Hey I am trying to modify the default value of a form field every time the form is updated. I have tried to edit the $form->bind in my processForm (..) but I am unsure how to do so. Is it possible to get some example code or any approaches to do? The field name is 'processed' and I am trying to set the value to 'false' - Using Symfony...

How put a Task (sfBaseTask) in unitest ?

How i can write an unit test, for my Task (sfBaseTask) ? ...

how can I find out if a method exist for a doctrine model in symfony?

I have a doctrine model that has a method getSomethingId() and I'm making something of an automated form generator for internal use in the company how can I check if my model has this method? I've tried with php's method_exists but it returns false for every method, what can I do? thanks ...

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

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

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

HowTo: customize & internationalize error codes/messages in Symfony?

Is there a simple way to modify/customize error messages generated by Symfony validators? eg. When using a string validator, if the field is empty, then the message "Required" is displayed by default with the field. This surely comes from its class, but is there a way to change the message for the String Validator globally so that it...

Symfony - set form value on save

Hi all, A quick question. I have a symfony form. When I save the form, I want my created_by field to be set automatically on save. So, i'm passing the current user id as an option in the form: $this->form = new ContractForm(null,array("created_by"=>$this->getUser()->getId())); And in the configure method of the form class I have: $...

How do I load a module specific custom helper from a task in symfony?

I'm rendering a partial from inside a task in symfony 1.4.6... $this->configuration = $this->createConfiguration(app, env, false); $this->configuration->loadHelpers(array('Partial')); $context = sfContext::createInstance($this->configuration); $html = get_partial(partialName, params); ...Inside the partial there is a reference to a c...

Setting Content via Response Object in Components

Hi, Can someone explain to me why the following code isn't outputting anything in a component? Does the response object in a component behave differently from that in an action (since the code works as part of an action)? I am using Symfony 1.4. $this->getResponse()->setContent("OK"); Code block: class merchantComponents extends s...

Including CSS in an email sent from a task in symfony

I am attempting to send an HTML email from a symfony (1.4.6) task, I don't want to send the entire rendered HTML output from a particular module/action, so I am rendering a partial. That's all fine, the issue is that the partial contains CSS references. Is there a nice 'symfonic' way of including a CSS file in an HTML email from a symfo...

Integrity constraint violation: 1048 Column cannot be null error

I'm getting a weird error in symfony 1.4 with doctrine 1.2. My schemas seem to be normal. But whenever I execute the doctrine:build --all --no-confirmation --and-load task, it would output the error SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'default_edition_id' cannot be null. If I set notnull to false for the default_...

Symfony embedRelation options - setting sub-form field visibility

The prototype of embedRelation makes reference to an 'options' array (passed as $formArguments/$formargs). Is it possible to pass an options array: embedRelation("Model","ModelForm",$options_arr); Where the options_arr contains form validator/widgets/etc to set for the relation? $formargs['something']['publish_date'] = new sfWidget...

Symfony schema works on my local server, but gives foreign_key constraint issues moving to Dreamhost

I'm using symfony 1.4 and doctrine. I've spent the last couple days playing with my schema, and I've gotten it to load up / build / behave properly but only on my local machine. When I copy the files to an account on Dreamhost, change the configuration to allow a connection to that database (and nothing else) I get the following error tr...

How to throw an error in an embedded form's post validator (sfForm)

With Symfony 1.4's Forms, how can I throw a sfValidatorError in the post validator of an embedded form? My parent form calls the following: public function configure(){ $this->embedForm('page', $pageLinkForm); } And my embedded form: public function configure(){ $this->validatorSchema->setPostValidator(new sfValidatorCallbac...

Symfony 1.4: doctine i18n problem

Hi Volks, I have a weird problem with my i18n doctrine schema and i.a. the admin generator. (Please look at the edit part below first) The schema looks like: CargoSize: connection: doctrine actAs: Timestampable: ~ I18n: fields: [name, linkname, seoname, description] tableName: com_cargo_size...

What are your best practices when developing symfony 1.4 forms/widgets/validators?

I am currently working on some symfony form customisation which includes writing widgets or better still extending existing ones. However this proves to be much more complicated as I thought it would as the functionality for validating, form elements, object saving, dynamic javascripts and so forth seem to be scattered all over the plac...

[Symfony] Update all i18n fields from an action

What I'm trying to do is relatively simple but I can't find documentation. Let's say I have a model Thing with a field label. The label field is internationalized. How can I update all label fields from a model or an action? (I'm using Doctrine) ...

What does this doctrine query do?

$this->facebook_applications = Doctrine::getTable('FacebookApplication') ->createQuery('a') ->execute(); I don't understand how this works at all. Why is the query just 'a' and why does that seem to get a list of the applications? ...