This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Today's Messages (OFF)  | Unanswered Messages (ON)

Forum: symfony 1.1
 Topic: [SOLVED] i18n metatags
[SOLVED] i18n metatags [message #64620] Thu, 06 November 2008 11:17
Murena  is currently offline Murena
Messages: 41
Registered: October 2008

I need to set dynamic meta tags for every page. I can do this by using


(by the way is there a better way?)

I want meta to be translated for every language.
It seems I can't use the i18n __() function in actions.

How can I do?


I can use __() from actions like this

$this->getContext()->getI18N()->__($text, $args, 'messages');

[Updated on: Thu, 06 November 2008 12:16]

 Topic: referring page
referring page [message #64726] Fri, 07 November 2008 08:22
maxxyb  is currently offline maxxyb
Messages: 5
Registered: September 2008
Junior Member

How do I find out what the current page is from the base layout.php page? I have some links that are only displayed when a user is on a certain page and these links are on the global layout page.

I've been trying $this->getGlobalVars() to try determine what global vars are available for me on the template page but, to be quite honest, I don't know what object "$this" refers to. An error is being thrown as a result of my call indicating that the object is sfPHPView and the API doc indicates that sfPHPView does have a getGlobalVars() function ... yet still I get the error.

I feel I'm going around in circles on this one so if anyone can help me out with a solution to what I'm trying to achieve or a better method of achieving it, I'd be very happy!
 Topic: forms1.1 field with special chars is empty
forms1.1 field with special chars is empty [message #64774] Fri, 07 November 2008 18:31
freakx0  is currently offline freakx0
Messages: 77
Registered: November 2006
Location: Germany
I'm using sf1.1 with the new forms.
If i want to edit an entry, the forms field which includes special chars like "äöü.." is empty. All other fields are filled with the correct values.
i don't know why that field is empty...

anybody an idea?
 Topic: Calling symfony cc from my own task
Calling symfony cc from my own task [message #64863] Sun, 09 November 2008 23:49
Notorious  is currently offline Notorious
Messages: 147
Registered: March 2007
Senior Member
I was wondering how I can call the symfony cc task in my own task? If you have access to the exec() function it should be doable but what if you don't?

Or is it even possible to extend the symfony tasks?

My goal is to create a class depending on some information in the DB. The only time this class has to be generated is when the symfony cc command should be called.
 Topic: Documentation not available under 1.1
Documentation not available under 1.1 [message #64866] Mon, 10 November 2008 00:23
shija03  is currently offline shija03
Messages: 12
Registered: November 2006
Junior Member
I've been using Symfony 1.0 for a long time, and I loved it (better than Cake and Akelos).

Now there is PHP 1.1 and there are significant changes on the form generation and other matters. I bought the 1.0 book, but the 1.1 is not available - should there not be at least a PDF available? If there is, can someone point it out to me?

 Topic: get value from url
get value from url [message #64929] Tue, 11 November 2008 07:33
sann  is currently offline sann
Messages: 2
Registered: October 2008
Junior Member

I have this problem,i am executing function and redirecting into another page with passing two variables

public function executeCheckout($request){

$def_id = '65672342347';
$price = '34.50';



i have problem with get these two values in mydef page, how can i get thses two values, what i need to use for get thses two values in mydef page.

please help me.

Thanks in advance
 Topic: Setting web_debug in module.yml - can it be done?
Setting web_debug in module.yml - can it be done? [message #64952] Tue, 11 November 2008 12:24
martyn.mahmoud  is currently offline martyn.mahmoud
Messages: 39
Registered: September 2007
Hi All,

I have a module called imagegen - whos actions just output dynamically generated images.

In dev mode, symfony appends the web_debug toolbar to all pages - but I want this to be switched off for the imagegen module. I've tried the following but with no luck:

    web_debug: off

followed by the customary symfony cc.

Any Ideas?

 Topic: Save a form with fields from 5 tables (Symfony 1.2/Doctrine/InnoDB)
Save a form with fields from 5 tables (Symfony 1.2/Doctrine/InnoDB) [message #64961] Tue, 11 November 2008 13:58
sympa  is currently offline sympa
Messages: 10
Registered: November 2008
Junior Member

The form have lots of fields from many tables.
I would like to save data from the first table (Transaction), then the second (Mano)... and do a Commit only if the last insert/update to the last table is ok.

After the insert in Transaction I need the value of the new transaction_id created because it's PK for the other tables.

Can I use something like the executeUpdate() generate by the crud ?

public function executeUpdate($request)

$this->form = $this->getAuthorForm($request->getParameter('id'));

if ($this->form->isValid())
$author = $this->form->save();


Thanks for your help !
 Topic: update forms.class file
update forms.class file [message #64963] Tue, 11 November 2008 14:31
dassa  is currently offline dassa
Messages: 17
Registered: October 2008
Junior Member
Hi All,

I am doing my first symfony project, i have two tables and corresponding files also.

I have added one more table and executed the following commends and generated the files, but the form.class file not generated for that table.

symfony propel:build-model
symfony propel:build-sql
symfony propel:insert-sql

What command i need to execute to update the third table form.class file.

please advise me

 Topic: Doctrine_Validator_Exception
Doctrine_Validator_Exception [message #64971] Tue, 11 November 2008 16:40
sympa  is currently offline sympa
Messages: 10
Registered: November 2008
Junior Member

When I save a form I've got a 500 | Internal Server Error | Doctrine_Validator_Exception
Validation error in class Transaction

I think it comes from that field:
'createdby' => new sfValidatorDoctrineChoice(array('model' => 'User'))

I tried to hardcored a hidden createdby field in the form, same error.

In the stack trace the error comes after save and commit
(2. at Doctrine_Transaction->commit(null))

Any ideas ?
 Topic: Problems using custom validator
Problems using custom validator [message #64996] Tue, 11 November 2008 19:30
Messages: 1
Registered: November 2008
Junior Member
I created my custom validator class and put it under the /project/lib folder.

Then when i try to execute my app i get this error:

A field must be an instance of sfValidatorBase.
stack trace
at ()
in SF_SYMFONY_LIB_DIR\validator\sfValidatorSchema.class.php line 314 ...

if (!$validator instanceof sfValidatorBase)
throw new InvalidArgumentException('A field must be an instance of sfValidatorBase.');

$this->fields[$name] = clone $validator;

any idea? Thanks in advance!
 Topic: pakeException
pakeException [message #65036] Wed, 12 November 2008 13:08
arul  is currently offline arul
Messages: 8
Registered: September 2008
Junior Member
Hi all,

I tried to generate forms using the following command,

symfon propel:build-forms

but getting this error
 Task "propel:build-forms" is not defined.

please advice me.

Thanks in advance
 Topic: Using components
Using components [message #65045] Wed, 12 November 2008 13:46
Vadim  is currently offline Vadim
Messages: 19
Registered: October 2008
Junior Member
Hi guys,

I wonder if I can use component for a partial stored in apps\frontend\templates? If I can - where should the component be located?
 Topic: Autoloading problem
Autoloading problem [message #65055] Wed, 12 November 2008 15:07
Vadim  is currently offline Vadim
Messages: 19
Registered: October 2008
Junior Member
Hi folks,

I have noticed the following autoload problem.
I specified a class called "MyTools" in \lib\myTools.class.php - so it should be autoloaded anywhere in my application. But it's autoloaded only in actions called "executeIndex" and in templates called "indexSuccess".
How can I change this odd behaviour and make this class autoloadable anywhere? Or how can I load it by hand?
 Topic: Issues with setDefaultFormFormatterName (it doesn't work well!)
Issues with setDefaultFormFormatterName (it doesn't work well!) [message #65066] Wed, 12 November 2008 18:04
Seikilos  is currently offline Seikilos
Messages: 609
Registered: May 2008
Location: Germany
Faithful Member
EDIT: This was experienced with a milestone prior to 1.1.5. This bug was fixed with 1.1.5 that was available a couple of days ago.
So having an svn version that is 4 days old means deprecation and useless threads here :/

I have a user Tabe, generated User class and generated Forms UserForm, BaseFormPropel and BaseUserForm.

Then I renamed UserForm to UserFormRegister because this one should only be used at the registration.

I put the following code into BaseFormPropel to ensure a div and not table generator for forms:

abstract class BaseFormPropel extends sfFormPropel
  public function setup()

BaseUserForm.class.php is autogenerated and does its own setup things like defining widgets and validators. Finally it calls
class BaseUserForm extends BaseFormPropel
  public function setup()
    ... setting widgets
    ... setting validators

which invokes the div formatter (this does work)

The UserFormRegister class is empty, so it does not interfere in this process.

The output of the form is however wrong. It seems that the formatter is completely ignored and I see a table output, which should be a div output. So even if the parent::setup() is invoked, it is not concidered.

When I rewrite the BaseUserForm, which IS bad, since it is autogenerated and put the parent setup before the setting of widgets and validators, e.g.:
class BaseUserForm extends BaseFormPropel
  public function setup()
    ... setting widgets
    ... setting validators

then it works!
But since it is autogenerated this is not a solution.

Does somebody know, why this works in such a weird way? I need a hint, since I cannot work with forms now.

Edit & Update this is a buggy behaviour because the parent initalization must come before any setWidget operation occur.
This is NOT noticable when the user writes a new setWidget in his own UserFormRegister class.

So it is reproducable when the UserFormRegister does not contain any calls to setWidgets

[Updated on: Wed, 12 November 2008 18:24]

Debugging is all I doֻ (if these dots are not in line then your screen is broken)
 Topic: Occasional error
Occasional error [message #65205] Fri, 14 November 2008 15:49
Murena  is currently offline Murena
Messages: 41
Registered: October 2008
Sometimes when I load a page I receive this error. Can't replicate.

Warning: Division by zero in .../symfony-1.1.4/lib/debug/sfWebDebug.class.php on line 257

 Topic: I18n & Admin generator
I18n & Admin generator [message #65275] Sun, 16 November 2008 01:48
yonialhadeff  is currently offline yonialhadeff
Messages: 37
Registered: February 2008

Is there a easy way to use the admin-generator or CRUD in order to manage i18n from the database ?

I look a long time ago in the forum/help/snippets didn't find anything

I was using this for symfony 1.0, but it doesn't work on symfony 1.1

      title:            "Product"
          - nameid
          - categorie_id
          - _image
          - _pdf		  
          - name_i18n_en
          - name_i18n_fr	
          - shortbody_i18n_en
          - _shortbody_i18n_ff
          name: english
          params: disabled=false
          name: french
          params: disabled=false

how can I do it with Symfony 1.1 ?


 Topic: Bug in retrieveByPk()?
Bug in retrieveByPk()? [message #65315] Sun, 16 November 2008 19:37
tresiab  is currently offline tresiab
Messages: 1
Registered: November 2008
Junior Member

I have the problem that a new object isn't added to the sql database even though the form data is valid. I'm using symfony 1.1's CRUD generation tool which creates an actions.class.php file which contains code similar to;

public function executeUpdate ($request)
$this->forward404Unless ($request->isMethod ('post'));

$this->form = new FooForm (FooPeer::retrieveByPk ($request->getParameter ('id')));

$this->form->bind ($request->getParameter ('foo'));
if ($this->form->isValid ())
$foo = $this->form->save ();

I discovered that for a new object where $request->getParameter ('id') is null a sql query which searches for entries "where id is null" is being performed. I think this is unnecessary and it calls for some optimisation.

I discovered that the reason why the new object isn't stored in the database is because FooPeer::retrieveByPk ($request->getParameter ('id')) does (incorrectly) return a previous entry from the database table even though $request->getParameter ('id') is null. This results in "$this->form->isValid ()" being true and "$this->form->save ()" does an update instead of an insert as the "isNew" function call returns false in the "doSave" function of the BaseFoo class.

I solved this problem by changing the generated code to;

public function executeUpdate ($request)
$this->forward404Unless ($request->isMethod ('post'));

if ($request->getParameter ('id'))
$foo = FooPeer::retrieveByPk ($request->getParameter ('id'));
$foo = new Foo ();

$this->form = new FooForm ($foo);

$this->form->bind ($request->getParameter ('foo'));
if ($this->form->isValid ())
$foo = $this->form->save ();

Is it a bug that retrieveByPk returns an entry for a null value? Has anyone else experienced this problem?

 Topic: partial field and filter with admin generator
partial field and filter with admin generator [message #65394] Mon, 17 November 2008 22:56
pajak  is currently offline pajak
Messages: 3
Registered: November 2008
Junior Member

i try to make partial filter on partial field with admin generator.
partial field named godzyear is made as 4 digit year part (eg. 2008) from table field which contains date. it is located in ...\modules\godziny\templates\_godzyear.php

<?php $datetime = new DateTime($godziny->getData() . ' 00:00:01');
echo DATE_FORMAT( $datetime, "Y"); ?>

partial filter looks:
<?php echo select_tag('filters[godzyear]', options_for_select(array(
  '' => '',
  '2008' => '2008',
  '2009' => '2009',
  '2010' => '2010',
  '2011' => '2011',
), isset($filters['godzyear']) ? $filters['godzyear'] : '')) ?>

it is located in ...\modules\godziny\templates\_godzyear_filter.php

here is generator.yml
     godzyear:        { name: Rok }
     godzmonth:       { name: Miesiąc }
     ilosc_godzin:    { name: Godziny }
     ilosc_godzin_ot: { name: W tym nadgodzin }
     title:           Przepracowane godziny
     display:         [ pracownik_id, _godzyear, godzmonth, data, dzien_id, ilosc_godzin, ilosc_godzin_ot]
     filters:         [ _godzyear_filter, godzmonth ]

in action i see aditional column called Rok with proper values and there is a drop-down filter with proper values but this two things does not works together.

i saw in generated code that filter try to use field GODZYEAR_FILTER so it's the reason of not filtering. when i had getGodzYear() in module generated code was trying to get GodzinyPeer::GODZYEAR field which doesn't exist in database Sad

is it possible to have such combination of field and filter? if yes how to make it works?

best rgds
 Topic: Moving localhost to my server
Moving localhost to my server [message #65405] Tue, 18 November 2008 10:01
somu  is currently offline somu
Messages: 9
Registered: September 2008
Junior Member
Hi all,

I have uploaded my symfony project from local server to live server, i need to change the url.

Now its running path like this,

i want to run the project like this,

What procedure i need to do, Please advice me

 Topic: pb actions: icon with the generator (symfony 1.1)
pb actions: icon with the generator (symfony 1.1) [message #65442] Tue, 18 November 2008 16:27
gerard  is currently offline gerard
Messages: 1
Registered: November 2008
Location: france
Junior Member

A problem about actions: /icon with the generator (symfony 1.1)

I add, in the generator.yml file, a new personal object_actions (addLink ) that works - and looks well - and a page action showhelp ( the problem ) : it happens that the icon disappears after a list or an edit user action : I cannot write a stable location for this help.png icon.

_edit: ~
addLink: { name: new link, action: addLink, icon: /images/addlink.png } //<== in /web/images/
_create: ~
showhelp: { name: help, action: showHelp, icon: ../images/help.png } //<== also in /web/images/

Has someone a solution ?


 Topic: exeucteUpdate not receiving request parameters sent by browser
exeucteUpdate not receiving request parameters sent by browser [message #65455] Tue, 18 November 2008 20:48
dagger  is currently offline dagger
Messages: 8
Registered: July 2008
Junior Member

I have a CRUD for model licenseeselectedcategories (which is also the name of the module) and when ever i try to create a new entry ... the function executeUpdate do not receive the request parameters submitted by the form...

nothing special in the function ... other modules working perfectly fine... but not this ... the code of the method is given below

  public function executeUpdate($request)
//$request->getParameter('categoryid') and 'oemid' returns null / empty / nothing
    $this->form = new LicenseeselectedcategoriesForm(LicenseeselectedcategoriesPeer::retrieveByPk($request->getParameter('oemid'),
    if ($this->form->isValid())
      $licenseeselectedcategories = $this->form->save();
      //$this->forward('licenseeselectedcategories', 'index');


the editSuccess.php code is below

<?php echo $form['categoryid']->renderError() ?> 
				<?php echo $form['categoryid'] ?>

				<?php echo $form['oemid'] ?>

when the browser renders the page following html tags are generated

<select id="licenseeselectedcategories_categoryid" name="licenseeselectedcategories[categoryid]">
       <option selected="selected" value=""/>
       <option value="991">Entertainment</option>
       <option value="234">Games</option>
       <option value="768">Business & Professional</option>
       <option value="855">Productivity</option>
       <option value="911">Lifestyle</option>
       <option value="170">Dictionaries</option>
       <option value="121">e-Books</option>
       <option value="212">Localization</option> 
       <option value="145">Utilities</option>
       <option value="443">Travel</option>
       <option value="450">Security</option>
       <option value="469">Synchronization</option>
       <option value="477">Health</option>
       <option value="485">Italian</option>
       <option value="493">French</option>
       <option value="505">German</option>
       <option value="531">TestNewsletter</option>

<input id="licenseeselectedcategories_oemid" type="hidden" value="34" name="licenseeselectedcategories[oemid]"/>

<input type="submit" value="Save"/>

<a onclick="new Ajax.Updater('categories', '/licensee/web/cpanel_dev.php/licenseeselectedcategories', {asynchronous:true, evalScripts:false, onComplete:function(request, json){Element.hide('categories-preload')}, onLoading:function(request, json){'categories-preload')}});; return false;" href="#">cancel</a>

When the Save button is clicked - i can see that the browser has sent the value of the fields in the request to the server - but at the controller end - i don't seem to be getting any thing...

I have been struggling with this problem for a while now ... and am suffering on deadlines - any help will be appreciated...

Using Symfony 1.1, Apache, php v 5.2.6, and MySQL 5 on windows envirnoment

[Updated on: Tue, 02 December 2008 14:34]

 Topic: Functional testing scenario : create account and log with it
Functional testing scenario : create account and log with it [message #65491] Wed, 19 November 2008 11:51
Kivenkantaja  is currently offline Kivenkantaja
Messages: 23
Registered: October 2008
Junior Member
Hi everyone,

I'm testing my application with functional tests. I've already made tests about the creation of an account. It works fine.
But now I would like to create an account, and log in with it, but the connection never succeed.
Indeed, I understand that all this is processing in a special environment and so the account is not really created, but I guess that there is a way to emulate this kind of scenario.

Here is what I'm trying to do :

$b = new sfTestBrowser();
$signup = array('email' => '', 'password' => '1234', 'again' => '1234');
$signin = array('username' => '', 'password' => '1234');
$b->post('/inscription', array('signup' => $signup))-> // that's ok, my account is created
checkResponseElement('ul.error_list', '!/Passwords do not match/')-> // that's ok, but it's not my main test of course
setAuth('', '1234')-> // with or without it, that doesn't work
post('/login', array('signin' => $signin))->
checkResponseElement('ul.error_list', '!/User name or password is not valid/'); // so I should not have this message, but ... I've got it !

So I'm taking all suggestions and ideas Smile

thanks in advance !

[Updated on: Wed, 19 November 2008 12:09]

 Topic: image_tag without FIle Extetion
image_tag without FIle Extetion [message #65495] Wed, 19 November 2008 12:46
crypti  is currently offline crypti
Messages: 12
Registered: November 2008
Junior Member

I am using symfony 1.1.4 and found out that the image_tag function does not work for files without file extension. The ext '.png' will be added automatically.

Any solutions to avoid this?
 Topic: Creating a dropdown with a few disabled options
Creating a dropdown with a few disabled options [message #65499] Wed, 19 November 2008 13:51
buzi  is currently offline buzi
Messages: 62
Registered: January 2008

I'm using select_tag to create a drop down, with an array which creates the options for it.

I want to have a few options with disabled="disabled" (not the entire select tag).

Any thought about how can I do this ?

 Topic: My first symfony project tutorial - post/show redirect error
My first symfony project tutorial - post/show redirect error [message #65539] Thu, 20 November 2008 00:47
adas007  is currently offline adas007
Messages: 17
Registered: November 2008
Location: Poland
Junior Member
Sorry i created 2 the same posts :/

[Updated on: Thu, 20 November 2008 00:49]

 Topic: pager in a component
pager in a component [message #65546] Thu, 20 November 2008 05:10  is currently offline
Messages: 5
Registered: November 2008
Location: Cali, Colombia
Junior Member
Hi, how are you??
I'm building a site with componets, thas because I have to do multiple queryes to the database and show it in a single page.
I need to do a pager inside a component.
I made a pager in the Index action, in that page it works fine.
I navigate throught the pages with the url
coments/index/page/3 ... 2 ... 1 etc
thats the list of the comments. the links of the pages are created with this
link_to($page, 'coments/index?page='.$page)
« < 1 - 2 - 3 - 4 - 5 > »

so, how could i do to create that links inside a component??
if I have a component called executeList, and the template _List .. which would it be the url to create the links? thanks for the help.

Daniel Alejandro
 Topic: Problem with dynamic i18n forms
Problem with dynamic i18n forms [message #65614] Thu, 20 November 2008 15:19
Higidi  is currently offline Higidi
Messages: 2
Registered: October 2008
Junior Member

i'm looking for the finest solution for dynamic i18n forms.

External webmaster have the chance to add and edit for example tags accross a soap interface. Due the soap request on serverside i have to dynamic embed an i18n form to validate the input, but first i think i have to validate the given culture. In symfony there is a sfCultureInfo class with a validateCulture method. Until totay i used this class to validate the given culture, but i don't think this is the finest way! Is there anyone with an other solution to work out with this situation?

regards higi
 Topic: Problem with plugin installation
Problem with plugin installation [message #65659] Fri, 21 November 2008 06:04
hpharipriya  is currently offline hpharipriya
Messages: 10
Registered: November 2008
Junior Member

I am trying to install the plugin
xsPasswordManagerPlugin, to my application.

But when I run this command
symfony plugin-install
I am getting some errors and warnings like this:

installing plugin ""
PHP Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/DependencyDB.php on line 398
PHP Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/DependencyDB.php on line 398
PHP Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/DependencyDB.php on line 398
PHP Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/DependencyDB.php on line 398
PHP Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/DependencyDB.php on line 398
PHP Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/DependencyDB.php on line 398
PHP Notice: Array to string conversion in /usr/share/pear/PEAR/Registry.php on line 456
PHP Fatal error: Call to a member function setConfig() on a non-object in /usr/share/pear/PEAR/DependencyDB.php on line 533

Also I am getting the same error and warnings when i tried to in stall sfGuardPlugin
with this command:
symfony plugin:install sfGuardPlugin

Please help me with this...

Haripriya S.

[Updated on: Fri, 21 November 2008 06:09]

 Topic: Error - Call to undefined function observe_field()
Error - Call to undefined function observe_field() [message #65673] Fri, 21 November 2008 08:29
hpharipriya  is currently offline hpharipriya
Messages: 10
Registered: November 2008
Junior Member


I have installed the sfPasswordStrengthPlugin.

and in my success page, i tried to the password checking.

I did it like this:

Successs.php page:

<?php echo observe_field('new1', array(
'update' => 'strength',
'url' => 'content/calculateStrength',
'with' => "'new1='+value'",
'method' =>'GET',
'script' => true,
'frequency'=> 0.5,

in the action page I wrote the calculateStrength function:

But I am getting the error:
Call to undefined function observe_field()

Am I doing something wrong?

-Haripriya S.

 Topic: Problem of registered handler
Problem of registered handler [message #65713] Fri, 21 November 2008 14:35
regis  is currently offline regis
Messages: 8
Registered: November 2008
Junior Member
Hi !!!

I have a new problem, when i want to clear my cache i have this error. I'm working with a sandbox and i would prefer to keep it instead of installing a synfony version. Embarassed

Thanks for help.

here is my code:

C:\Program Files\EasyPHP 2.0b1\www\SYTGEMweb> php -c "C:\Program Files\EasyPHP 2.
0b1\apache" symfony cc
>> cache Clearing cache type "all" for "frontend" app and "prod" env

Configuration file "C:\Program Files\EasyPHP 2.0b1\www\SYTGEMweb\lib\symfony/c
onfig/config/settings.yml, C:\Program Files\EasyPHP 2.0b1\www\SYTGEMweb\apps\fro
ntend/config/settings.yml" does not have a registered handler.
 Topic: Nested form with file upload and doctrine
Nested form with file upload and doctrine [message #65745] Fri, 21 November 2008 23:13
Anton74  is currently offline Anton74
Messages: 6
Registered: September 2008
Location: Netherlands
Junior Member
I'm having the following problem:

I have made an nested form where one is a file upload form.
When I save the main_form, the file is not saved in the table (the file has been physically uploaded).
I thought that doctrine can handle saving nested forms.

Here is the code I used:

The embedform:
class PhotoCollectionForm extends BasePhotoCollectionForm
  public function configure()
    $photo = new Photo();
    $this->embedForm('photo', new PhotoForm($photo));  	

The upload form:
class PhotoForm extends BasePhotoForm
  public function configure()
      'id'                  => new sfWidgetFormInputHidden(),
      'filename'            => new sfWidgetFormInputFile(),
      'photo_collection_id' => new sfWidgetFormDoctrineSelect(array('model' => 'PhotoCollection', 'add_empty' => true)),
      'id'                  => new sfValidatorDoctrineChoice(array('model' => 'Photo', 'column' => 'id', 'required' => false)),
      'filename'            => new sfValidatorFile(),
      'photo_collection_id' => new sfValidatorDoctrineChoice(array('model' => 'PhotoCollection', 'required' => false)),


The update action:
public function executeUpdate($request)

    $this->form = $this->getPhotoCollectionForm($request->getParameter('id'));

    $this->form->bind($request->getParameter('photo_collection'), $request->getFiles('photo_collection'));
    if ($this->form->isValid())
    	$photo = $this->form->getValue('photo');
    	$filename = $photo['filename'];
      	$filetext = sha1($filename->getOriginalName()).$filename->getExtension($filename->getOriginalExtension());
        $photo_collection = $this->form->save();



The photo_collection table is saved correctly, but the photo table is not saved. The file itself has been uploaded to the web folder.

What am I missing here ?
 Topic: How to translate admin generator
How to translate admin generator [message #65819] Sun, 23 November 2008 22:44
jaapio  is currently offline jaapio
Messages: 11
Registered: April 2008
Junior Member

is there a way to extract the i18n from the generated admin pages?
the normal extreaction doesn't work for the cache files
 Topic: Multiple insert in Admin module
Multiple insert in Admin module [message #65821] Mon, 24 November 2008 00:04
kmarco100  is currently offline kmarco100
Messages: 1
Registered: November 2008
Junior Member

I new to symfony and after following the admin video tutorial I'm manage to create a very decent admin dor my project, but since some tables in the database are going to have many MANY rows I would like to know if is possible to automatically generate a form to add several records instead of just one at a time ? is the a way or plugin to do this in symfony 1.1 ?
 Topic: in_place_editor doesn't seem to work
in_place_editor doesn't seem to work [message #66012] Wed, 26 November 2008 08:46
gmccumskey  is currently offline gmccumskey
Messages: 7
Registered: July 2008
Junior Member
Sorry if the title is a little ambiguous but there really is very little else to describe it.Basically, after reading the info in the book and API docs about the in_place_editor_tag helper and attempting to create one, clicking on the text that should be editable results in .. well .. nothing.

I have even viewed the source code using Firebug to see what the Javascript is that affects this and see nothing at all.

The div id is dynamic as well as the text itself (obviously) and the relevant PHP code is:

<div id="editinplace<?php echo $ou->getId() ?>"><?php  echo $ou->getName() ?></div>
	    <?php echo input_in_place_editor_tag('editinplace'.$ou->getId(), 'organisational_units/edit', array(
	       'cols'=> 4, 
	       'rows' => 1, 
	       'submitOnBlur' => 'true', 
	       'okControl' => false, 
	       'cancelControl' => false )) ?>

Clicking on the text generated by $ou->getName() does nothing. Just to mention as well, this is all happening within a div that gets asynchronously updated as well if that makes a difference.

If any other info is required to help resolve this please feel free to ask as I am not sure what else might be pertinent.
 Topic: unwanted characted when disabling layout
unwanted characted when disabling layout [message #66056] Wed, 26 November 2008 15:20
whiteneck  is currently offline whiteneck
Messages: 10
Registered: October 2006
Junior Member

I have disabled the layout in my config/view.yml and changed the template of an action (editSuccess) so that I could echo what I want.
Let's say I put echo "hello world"; in this template, then when I run the module/create I have <hello world; With the "<" - inferior character.

I've looked everywhere and carefully to see if I had not left that character by mistake somewhere, but it seems I did not.

One thing even stranger is that if I change the indexSuccess template with the code of editSuccess (here: echo "hello world") and disabled the layout for that action, then I'll get "hello world" without the character.
I've tried with other modules, and it's the same. This unwanted character when the action is create, no character when it's index.

Any idea?
 Topic: Cache and include_component
Cache and include_component [message #66064] Wed, 26 November 2008 16:18
Kivenkantaja  is currently offline Kivenkantaja
Messages: 23
Registered: October 2008
Junior Member
Hi all,
I'm trying to cache 'partials' which are included into other 'partials'.

For example, I have a partial called "_house", and into its code I call the partial called "_room" with the 'include_component()' function.
// some code about the "house"
include_component( ..., room, ...);
// the end of the code of the "house"

I want the partial "_room" to be put in cache during 10 seconds, and the "_house" during 20 seconds.
But unfortunately, the "_room" remains 20 seconds in cache... In a way it's logical, but I was guessing there is a manner to put pieces of code inside other pieces.

Here is the cache.yml :
  enabled:     on
  with_layout: false
  lifetime:   10

  enabled:     on
  with_layout: false
  lifetime:    20

Hoping this behavior is available ...
Thanks in advance !
 Topic: Reuse modules in another module by generator.yml
Reuse modules in another module by generator.yml [message #66068] Wed, 26 November 2008 16:43
master_p  is currently offline master_p
Messages: 16
Registered: April 2007
Location: Hamburg, Germany
Junior Member

I searched all over the web, but haven't found the answer and am not even sure, that there is one.

I have two modules. 1st ist company and 2nd ist address. So the edit-action looks like this:

1st module
Name: Company XY
Description: xyz xyz xyz ...

2nd module:
Street: companystreet
ZIP: 90210
Phone: +41...
Fax: ...

and so on

But now I want to put the address-"module" into the company-module, so I can edit both at once. Is there any possibility to do that by the generator.yml? After all the edit-form is already there in the 2nd module. Do I have to put a partial and script all that manually into the 1st module or is there any way to reuse the generated code from my 2nd module?
 Topic: Problem with writing entities to DB
Problem with writing entities to DB [message #66156] Thu, 27 November 2008 14:31
masterix  is currently offline masterix
Messages: 41
Registered: September 2008

I have XML file which contains entities instead of diacritic signs. I wrote:
$tmp[$x] = html_entity_decode($v, ENT_COMPAT, "UTF-8" );

And after displaying it I can see correct letters. But when I call method to save it to DB nothing happens - no exceptions, no data in DB, blank page.

What's going on?

 Topic: Custom Admin Submit
Custom Admin Submit [message #66171] Thu, 27 November 2008 16:38
deutsch  is currently offline deutsch
Messages: 8
Registered: November 2008
Junior Member

I want to share soma ideas about costom submitting in the backend, via generator.yml and a template file. It works fine, but im almost sure, that there exist a nicer solution.

In my example, i had to make a creation wizard in the backend, but how it is possible, because the

-you can override functions (execucteSave, etc.)
-you can define new actions

-you cant override functions(I mean i was not able to)
-you can define nice new things like "create:"

I used the propel stuff.

Tricky part: if you use the sfPropelAdminGen, the (url)/backend.php/(model)/edit and the (url)/backend.php/(model)/create navs you to the same site, because the sfPropelAdminGen is not able to handle the "create" part. So, if we want to separate the submitting actions, which, in the "edit" site is "save", "save_and_list", "list", and in the "create" is "save_and_next" (in our wizard case), it goes like this:

Step one:
        NONE: [_save_and_next] (--important--)
        -custom parts-
        -our custom fields-
        _save_and_next: {  params: id=save_and_next,
 name: save and go to the next step 
in the eventcreation wizard } (--important--)
        _save_and_list: ~
        _list: ~

Step two:
we use jquery!
the file called "_save_and_next.php" is in the 'backend/modules/(our model)/templates
	$elf = $sf_request->getParameter('id');
			var id = "<?php echo $elf; ?>";
			if(id == null || id == 'undefinied' || id == ""){
				document.getElementById('save_and_next').type = 'submit';
				document.getElementById('save_and_next').style.display = "none";

Step three:
(and thatswhy we use sfPropAdminGen and not sfAdvAdminGen)
public function executeSave(){
   our custom code, with save and custom redirection

I hope you like it, it works fine fot me!

Greetings: Németh Balázs from Hungary

//first i posted this into the misc. forum, but i think its better here, so admins feel free to delete the useless one, thanks

[Updated on: Thu, 27 November 2008 16:42]

Pages (169): [ «  <  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  >  »]

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software