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.2
 Topic: Will Symfony 1.2 support sfCompat10?
Will Symfony 1.2 support sfCompat10? [message #65213] Fri, 14 November 2008 18:14
jan.lewis@vrs-soft.com  is currently offline jan.lewis@vrs-soft.com
Messages: 5
Registered: April 2006
Location: Orlando, FL
Junior Member

I have reviewed the documentation and am unable to determine if 1.2 will support sfCompat10. If not, our application will require significant refactoring. Thanks in advance!

Jan Rolling Eyes


~Jan
 Topic: Symfony 1.2 PartialView
Symfony 1.2 PartialView [message #65221] Fri, 14 November 2008 21:27
kennedy
Messages: 2
Registered: September 2008
Junior Member
Hi,

I noticed that I cannot use a different partial view class than sfPartialView for global partial. (i.e.: include_partial('global/mypartialtemplate'))

This issue is due to the fact that the PartialHelper checks for a module configuration. But the template is in the application directly.

I am using the sfSmartyPlugin (sfSmartyView, sfSmartyPartialView) for my frontend application.

PartialHelper get_partial method
$class = sfConfig::get('mod_'.$moduleName.'_partial_view_class', 'sf').'PartialView';

This line always returns sfPartialView when the module name is global.


EDIT: Should I open a ticket for that issue??
Regards,

[Updated on: Fri, 14 November 2008 21:28]

 Topic: autoload don't clear the Class -> File Name cache in DEV mode
autoload don't clear the Class -> File Name cache in DEV mode [message #65222] Fri, 14 November 2008 22:04
DeyV  is currently offline DeyV
Messages: 1
Registered: November 2008
Location: Poland/Wroclaw
Junior Member
In http://www.symfony-project.org/book/1_2/02-Exploring-Symfony -s-Code
we can read information:

Quote:

This is why you need to clear the cache every time you add or move a class file in your project by calling the symfony cache:clear command (except in the development environment, where symfony clears the cache once when it cannot find a class).


I'm work on sf_sandbox with symfony updated from svn [13002] - 14.10.2008

But on my pc, in dev mode, after creating new model or form class I'm always must clear the cache by hand (symfony cache:clear) because php throw:
Fatal error: Class 'xxx' not found in Action....

This is configuration bug in sf_sanbox or in symfony 1.2 beta2?

----
I'm work on windows vista x64 and WampServer

[Updated on: Fri, 14 November 2008 22:05]

 Topic: route has some missing mandatory parameters (problem in sfRoute.class.php?)
route has some missing mandatory parameters (problem in sfRoute.class.php?) [message #65309] Sun, 16 November 2008 18:57
n_i_o  is currently offline n_i_o
Messages: 1
Registered: November 2008
Junior Member
Hello,

I'm switching my project from sf1.1 to sf1.2 (beta2 for now) and I'm having trouble with some default values for the route variables (PHP 5.2.5):

Imagine that this is one part of my routing.yml:
route_name:
  url:   /mypath/:myvariable
  param: {module: mymodule, action: myaction, myvariable: 0}


If it comes to generating an URL (p.e. with link_to in a template), I get the following error message, in case I do not specify myvariable or myvariable takes the value 0:

The "/mypath/:myvariable.html" route has some missing mandatory parameters (:myvariable).

Digging into it I found that in sfRoute.class.php (Line 208) it says

// all params must be given
if ($diff = array_diff_key($this->variables, array_filter($tparams)))
{
  throw new InvalidArgumentException(sprintf('The "%s" route has some missing mandatory parameters (%s).', $this->pattern, implode(', ', $diff)));
}


The problem here seems to be the use of array_filter() because it removes keys from the $tparams array that have a value of 0 (== false ?!). This leads to array_diff_key to be true and throwing of the InvalidArgumentException.

My Questions:
Is array filter used intentionally at this point? Is this a misbehaviour of sf1.2 beta2? Are there any new settings for routing.yml in sf1.2, that I might have overseen?

Conclusion:
- So default values for a route variable of 0 are not possible at the moment.
- The use of array_filter might be incorrect in other places (in sfRoute.class.php)


Thanks for your replies.
 Topic: Symfony 1.2 admin generator form creation problem
Symfony 1.2 admin generator form creation problem [message #65328] Mon, 17 November 2008 02:43
MMacLeod  is currently offline MMacLeod
Messages: 34
Registered: April 2008
Member
Hi all,

I'm fairly new to Symfony and am trying to get a backend working. I'm using sfDoctrineGuard to secure the website. I can add and edit users with no problem in the backend. Another module is the category module. When I try to add a category nothing happens, it just returns to the empty category list. Looking at the code, it seems as if the form is not posting to the correct action:

<form action="/backend_dev.php/category" method="post">

Am I missing something here?

Here is the relevant schema info:

Profile:
columns:
sf_guard_user_id: integer(11)
name:
type: string(255)
notnull: true
email:
type: string(255)
notnull: true
email: true
status:
type: enum
values: [Active, Pending, Disabled]
created_at: timestamp
relations:
User:
class: sfGuardUser
foreignType: one
Categories:
class: Category
local: id
foreign: user_id
type: many
Limelights:
class: Limelight
local: id
foreign: user_id
type: many
News:
local: id
foreign: user_id
type: many
NewsComments:
class: NewsComment
local: id
foreign: user_id
type: many

Category:
actAs: [Timestampable]
columns:
name:
type: string(255)
notnull: true
age:
type: integer(3)
default: 0
notnull: true
parent:
type: integer
notnull: false
status:
type: enum
values: [Active, Pending, Disabled]
notnull: true
user_id: integer
created_at: timestamp
relations:
User:
class: Profile
local: user_id
foreign: id
Limelights:
class: Limelight
local: id
foreign: category_id
type: many

Any help/suggestions would be greatly appreciated.

Thanks!
 Topic: Interface Translation and new form templates
Interface Translation and new form templates [message #65385] Mon, 17 November 2008 18:37
matze123  is currently offline matze123
Messages: 19
Registered: April 2007
Junior Member
hi

this is from generated frontend template :

<th><?php echo $form['parent_id']->renderLabel() ?></th>

where can i insert the i18n

<?php echo __("Label to translate") ?>

in : class <model>Form ?

yes i can replace <th>...</th>
but this is not universal

greetings
matze


 Topic: admin generator with doctrine : no save (1.2svn)
admin generator with doctrine : no save (1.2svn) [message #65387] Mon, 17 November 2008 19:00
matze123  is currently offline matze123
Messages: 19
Registered: April 2007
Junior Member
hi all

there are many topics admin gen , but i never found this

in all 1.2 versions (beta,...,svn) :

the backend modules generates ok
i view index... ok
new ... ok
save ...
index
but no database-entry

log file : no sql
generated in cache : seems ok

is this a routing problem ?

matze

(so far i'm using symfony 1.0)

**********routing.yml********
....
ProjectStatus:
class: sfDoctrineRouteCollection
options:
model: ProjectStatus
module: ProjectStatus
with_show: true
collection_actions: { filter: post, batch: post }
*******************************
 Topic: [solved] databases.yml
[solved] databases.yml [message #65587] Thu, 20 November 2008 12:27
Flashball  is currently offline Flashball
Messages: 127
Registered: January 2008
Location: France
Senior Member
Hello,

I'm trying to do a propel:build-schema but i have a problem of configuration that i didn't have with sf1.0 and sf1.1

I have read some doc and use the "$ php symfony configure:database mysql://root:pa$$word@localhost/symfony_project".

Just after that, I try the build-schema and:
- Propel: "[propel-schema-reverse] There was an error building XML from metadata: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)"
- After setting the password param: "[propel-schema-reverse] There was an error building XML from metadata: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected"

Here's my databases.yml:
all:
  propel:
    class: sfPropelDatabase
    param:
      classname: PropelPDO
      charset: utf8
      encoding: utf8
      persistent: true
      pooling: true
      compat_assoc_lower: true
      dsn: 'mysql://root:root@localhost/my_database'
      username: root
      password: root


Thank you for your help.

ok here's the solution:
dsn: 'mysql:dbname=my_database;host=localhost'


it seems that the "php symfony configure:database" command is not update for sf1.2

[Updated on: Thu, 20 November 2008 12:53]

 Topic: Labels problem on admin generator. (bug?)
Labels problem on admin generator. (bug?) [message #65841] Mon, 24 November 2008 10:46
Murena  is currently offline Murena
Messages: 41
Registered: October 2008
Member
Hello,

I'm using the new admin generator.
In the list view, is it normal that the column names are not showing the label set in the form?
For example in form class

$this->widgetSchema->setLabel('name', 'Nome');


In edit view is ok.
Of course I can set the label in generator.yml.
But how can I set the label of a i18n field? It doesn't work in either way. Is it possible to reference i18n field in generator.yml?

Also what is the best way to align right a column in the list view?

[Updated on: Mon, 24 November 2008 10:48]

 Topic: great thanks : admin generator works properly
great thanks : admin generator works properly [message #65851] Mon, 24 November 2008 12:24
matze123  is currently offline matze123
Messages: 19
Registered: April 2007
Junior Member
in svn (rc1) version with doctrine

- data "save" go well
- default routes automatically generated with modules

matze
 Topic: Session issue, what could be causing this?
Session issue, what could be causing this? [message #65870] Mon, 24 November 2008 15:24
Murena  is currently offline Murena
Messages: 41
Registered: October 2008
Member
I have a strange problem.
On my pc when I login into a symfony application, the user doesn't appear authenticated until after a reload of the page.

On other clients I don't have this problem. I tried to reset session cache, cookies etc., nothing worked.

What could cause this?
 Topic: Generator field styles
Generator field styles [message #65880] Mon, 24 November 2008 18:03
bidule  is currently offline bidule
Messages: 47
Registered: November 2008
Member
Hi all,

I have to display fields in right-to-left languages in the generated lists and forms. Is there a way to specify a specific style like:
list:
  display: ~
  fields:
    name_fa: { title: Farsi, style: "direction:rtl; text-align: right" }

or do I have to do that in the css?
I know I can get it working through css, but I'd prefer to be able to do that through the generator.yml, if there is an option for this.

Thanks!
 Topic: How to change set the value of radio button
How to change set the value of radio button [message #65975] Tue, 25 November 2008 17:54
JC13  is currently offline JC13
Messages: 12
Registered: November 2008
Junior Member
Hi,

I need to display a grid of radio buttons and retrieve which one was checked at submit.
With Symfony 1.0 I used this code:

<table>
		<?php for($i = 1; $i <= $height; $i++): ?>
			<tr>
		  <?php for($j = 1; $j <= $width; $j++): ?>
		    <td>
				<?php echo radiobutton_tag('position', $i.'.'.$j) ?>
			</td>
		  <?php endfor ?>
		</tr>
		<?php endfor ?>
	</table>

Than, I could get the name with request parameter.

I want to use the 1.2 form version to do the same but I can't set the value of each button.

As the value is automatically set in the widget->formatChoices() function, I need to override and replace the entire function call, that is not a clean way to do.

Any idea ?

thx
 Topic: Functional tests : followRedirect not found
Functional tests : followRedirect not found [message #66145] Thu, 27 November 2008 12:30
naeh  is currently offline naeh
Messages: 7
Registered: October 2007
Location: France
Junior Member
Hello,
i saw in comments in lib/test/sfTestFunctionalBase.class.php, that some functions are deprecated in symfony 1.2 (isRedirected, isStatusCode, responseContains, isRequestParameter, etc.) and others no longer exist (followRedirect for example).

my question is, how to follow redirection if we haven't followRedirect() ?

Thank you Smile
 Topic: embedForm question - not required
embedForm question - not required [message #66148] Thu, 27 November 2008 12:49
andyr  is currently offline andyr
Messages: 1
Registered: November 2008
Junior Member
Hi, I have a form with several new forms embedded in it. Here is schema:

style:
id:
name: { type: varchar(20), required: true }

style_value:
id:
style_id:
value: { type: varchar(20), required: true }

In my StyleForm I have embedded the StyleValueForm 5 times:

public function configure()
{
  if(!$this->getObject()->isNew())
  {
      $tmpl = new StyleValue();
      $tmpl->setStyle($this->getObject());
      
      $form = new StyleValueForm($tmpl);
      $this->embedFormForEach("new_style_value", $form, 5);
  }
}


and that displays the forms ok. However, 'value' is required, and if i save the form, each sub-form fails because of the required field - as expected really. However, what I want to do is if the 'value' is left blank then not to attempt to validate or save it. If you imagine the scenerio where someone would enter 3 StyleValues and not the full 5 - I would want to save the 3 and ignore the 2 not entered.

I have looked at overriding bind() but that's too late - the form is already expecting the sub-forms.

Anyone any tips?

Thanks
 Topic: sandbox 1.2RC2 small packaging bug
sandbox 1.2RC2 small packaging bug [message #66155] Thu, 27 November 2008 13:58
bidule  is currently offline bidule
Messages: 47
Registered: November 2008
Member
I believe there's a small bug in sf_sandbox_1_2RC2.tgz symlinks:
> ls -al web/

sfPropelPlugin -> ../../lib/plugins/sfPropelPlugin/web
sfProtoculousPlugin -> ../../lib/plugins/sfProtoculousPlugin/web

Should be ../../lib/symfony/plugins/...
 Topic: Am I doing right?
Am I doing right? [message #66163] Thu, 27 November 2008 15:25
bidule  is currently offline bidule
Messages: 47
Registered: November 2008
Member
Hello,

This is very basic, but I'm learning.
I'm trying to retrieve the first result of a many-to-many join with a criterion, for display in the generator list. The following works fine, but I'm not sure that I'm doing it the right way, or in the right place:

<?php

class Program extends BaseProgram
{
  public function getDonor()
  {
    $cr = new Criteria();
    $cr->add(RelationshipPeer::NAME_EN, 'Donor');
    $relationship = RelationshipPeer::doSelectOne($cr);
    $relationshipId = $relationship->getId();

    $cd = new Criteria();
    $cd->add(ProgramOrganizationPeer::PROGRAM_ID, $this->getId());
    $cd->add(ProgramOrganizationPeer::RELATIONSHIP_ID, $relationshipId);
    $programDonors = $this->getProgramOrganizations($cd);

    if ($programDonors) {
      $programDonor = $programDonors[0];
      return $programDonor->getOrganization();
    } else {
      return '';
    }
  }
}


Thanks!
 Topic: [Bug? 1.2RC2] filters keyword in generator.yml gives error
[Bug? 1.2RC2] filters keyword in generator.yml gives error [message #66164] Thu, 27 November 2008 15:33
Murena  is currently offline Murena
Messages: 41
Registered: October 2008
Member
If I use

    config:
      actions: ~
      fields:  ~
      list:
          filters:  [name]
      filter:  ~
      form:    ~
      edit:    ~
      new:     ~


I receive

Your generator configuration contains some errors for the "list" context. The following configuration cannot be parsed: array( 'filters' => array( 0 => 'name', ),).
 Topic: Resolved - Forms not recreated
Resolved - Forms not recreated [message #66169] Thu, 27 November 2008 16:05
nico_somb  is currently offline nico_somb
Messages: 3
Registered: November 2008
Location: Lille, France
Junior Member
hi there!

I've got a problem with forms.

in my config/schema.yml, there was an integer field.
my forms were correct.

Next, I decided to modify my field to "float".

but, with these commands :
sf propel:build-sql
sf propel:insert-sql
sf propel:build-forms

, my form is not updated to "float".

i always have this message : "9.99" is not an integer, and in lib/form/base.BaseTestForm.class.php, there always is this line :
'myfield'         => new sfValidatorInteger(array('required' => false)),


Do you know why?

I hope you understand me...


# Edit : Oops... resolved.
I forgot
symfony propel:build-model
...

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

 Topic: symfony generate:project cms :[pack Exception]
symfony generate:project cms :[pack Exception] [message #66252] Fri, 28 November 2008 13:55
logonchristy  is currently offline logonchristy
Messages: 30
Registered: November 2008
Location: us
Member
HI i got pack Exception while using generate command
symfony generate:project cms
and php symfony list doctrine command

How to install symfony with doctrine

How to solve this...

[Updated on: Fri, 28 November 2008 13:58]

 Topic: The execution of task "doctrine:build-all-reload" failed.
The execution of task "doctrine:build-all-reload" failed. [message #66323] Sat, 29 November 2008 10:00
logonchristy  is currently offline logonchristy
Messages: 30
Registered: November 2008
Location: us
Member
I execute this command


symfony doctrine-build-all-reload myapp


I got this error message


The execution of task "doctrine:build-all-reload" failed.
  - Too many arguments ("doctrine-build-all-reload myapp" given).

How can i solve this...


 Topic: admin-generator Managing linked tables
admin-generator Managing linked tables [message #66450] Mon, 01 December 2008 16:04
Flashball  is currently offline Flashball
Messages: 127
Registered: January 2008
Location: France
Senior Member
Hello,

I want to know what is the right method to edit some of the related fields to an object. For example, I've got an "order", which can have severals "order_comment": when I edit an "order", I can insert a new "order_comment" related to this order which have to add in the "order_comment" table.

For the moment, I use a partial field to edit a comment, and I've overwrited a "doSave" method in my "OrdercommandForm" object to get the comment, and add a new line in the "order_comment" table.

Is it the right way to do? Can't we specify directly in the "generator.yml" that the field "comment" is linked to the "order_comment" object to have it automatically updated?

Thanks for your responses.
 Topic: sfPropelUniqueValidator with multiple fields
sfPropelUniqueValidator with multiple fields [message #66710] Thu, 04 December 2008 01:51
Flancer  is currently offline Flancer
Messages: 26
Registered: October 2007
Location: Malaysia
Junior Member
I want to ensure that two fields in my sfGuardProfile are unique at all times e.g. email and nric.

The generated code does not seem to work as it will prevent me from updating an existing record.

The only time I can update a record is if I change the value of both fields in a given record.

It seems the problem lies in sfPropelUniqueValidator.

I have even changed to this code:
new sfValidatorPropelUnique(array('model' => 'sfGuardUserProfile', 'column' => array('email','nric'))) 

but I still get the same problem.

Previously the generated code was
    new sfValidatorAnd(array(

        new sfValidatorPropelUnique(array('model' => 'sfGuardUserProfile', 'column' => array('email'))), new sfValidatorPropelUnique(array('model' => 'sfGuardUserProfile', 'column' => array('nric'))),

    ))

    );


Please help.
 Topic: debug toolbar - SQL Queries
debug toolbar - SQL Queries [message #66727] Thu, 04 December 2008 09:49
lionslair  is currently offline lionslair
Messages: 89
Registered: October 2007
Location: Perth / Western Australia
Member
In 1.2 my debug toolbar only shows the prepared sql statements. However I would like to show the executed SQL statements. I have been looking through the code and API but can not find a way to configure this. Has anyone managed to get the execute SQL queries show in 1.2


www.lionslair.net.au
 Topic: Apply layout in a filter
Apply layout in a filter [message #66813] Thu, 04 December 2008 22:47
bidule  is currently offline bidule
Messages: 47
Registered: November 2008
Member
Hi,

My application has to be displayed both in left-to-right and right-to left languages. I thus would like to use different layouts for the two cases.

I'm trying to build a filter, so that the correct layout is applied:

<?php
class languageFilter extends sfFilter //sfRenderingFilter
{
  public function 
execute($filterChain)
  {
    if(
$this->isFirstCall())
    {
      
$request $this->getContext()->getRequest();
      
$user $this->getContext()->getUser();
      
$culture $user->getCulture();

      
$stack $this->getContext()->getActionStack();
      
$i $stack->getFirstEntry()->getActionInstance();

      switch(
$culture)
      {
        case 
'fa':
        case 
'ps':
          
$i->setLayout('layout_rtl');
        case 
'en':
        default:
          
$i->setLayout('layout_ltr');
      }
    }
    
$filterChain->execute();
  }
}
?>


The filter executes correctly, but does have the desired effect.
I'm not really sure at what step along the filters chain the layout is called, and if what I'm trying to achieve is actually doable.

Thanks
 Topic: File Data Validation
File Data Validation [message #66817] Thu, 04 December 2008 23:01
bigtimery3k  is currently offline bigtimery3k
Messages: 1
Registered: December 2008
Junior Member
I'm wondering whats the best approach to validating the data in a excel file. The data will need to be validated against information that will be stored in the user session, plus other validation. The issue is, i don't know how to get the user session from inside the custom validator and i can't seem to find any similar implementation anywhere. Any ideas, snippets, links or such is greatly appreciated.
 Topic: upload file permission
upload file permission [message #66913] Fri, 05 December 2008 17:49
chemik  is currently offline chemik
Messages: 1
Registered: November 2007
Location: Bydgoszcz
Junior Member
Hi,

I used to check uploaded file sfValidatorFile.

'avatar'=>new sfValidatorFile(array('required'=>false,'max_size'=>102400,'mime_types'=>'web_images','path'=>'/admin/uploads/avatars/'),array('max_size'=>'error','mime_types'=>'error')),


How can i check permission to 'path' in this validator? Is it possible?

 Topic: What is the sfObjectRoute good for?
What is the sfObjectRoute good for? [message #67007] Sat, 06 December 2008 17:54
Seikilos  is currently offline Seikilos
Messages: 609
Registered: May 2008
Location: Germany
Faithful Member
I was reading the what's new and got to the sfObjectRoute point here: http://www.symfony-project.org/tutorial/1_2/whats-new#%3Ccod e%3EsfObjectRoute%3C/code%3E
Now Ihave some issues understanding the use of that thing.
What does the example route provided in the docs do?
article:
  url:     /article/:id
  class:   sfObjectRoute
  options: { model: Article, type: object, method: getById }

Is this rule callable from outside? So if I go to the webpace that has the /article/1 uri this route will be invoked. Fine.

But what will that do? What is the output? The method getById is called and creates an array of Articles but since this is a Article method what use does it have?
Or is that only usable in the code for retrieving things and so on?
How does the code look like then?


Debugging is all I doֻ (if these dots are not in line then your screen is broken)
 Topic: No difference between sfWidgetFormPropelChoiceMany and SelectMany
No difference between sfWidgetFormPropelChoiceMany and SelectMany [message #67021] Sat, 06 December 2008 23:54
masterix  is currently offline masterix
Messages: 41
Registered: September 2008
Member
Hi,

I need to have many choice tags in my form. Now I have the code:
  class CannibalActionForm extends sfForm
  {
  	public function configure()
  	{
  		$this->setWidgets( array( 
  								  'kw[]' => new sfWidgetFormPropelChoiceMany( array( 'model' => 'Client' ) )
  								) );
  								
  		$this->widgetSchema->setLabel( 'kw[]', 'Słowa kluczowe' );
  	}
  };

But what I get is the same as from sfWidgetFormSelectMany. Why is it so?

OK. I found expanded attribute Smile
It's OK now.

[Updated on: Sun, 07 December 2008 00:25]

 Topic: Functional tests: checkElement - all direct descendants
Functional tests: checkElement - all direct descendants [message #67081] Mon, 08 December 2008 11:22
joes  is currently offline joes
Messages: 10
Registered: December 2008
Location: Sweden
Junior Member
The following xml is returned by users/:id in my app:

<?xml version="1.0" encoding="utf-8"?>
<User>
  <id>1</id>
  <role>admin</role>
  <external_id></external_id>
  <password>admin</password>
  <created_at>2008-12-05 12:24:49</created_at>
  <updated_at>2008-12-05 12:24:49</updated_at>
</User>


I wish to write a test that checks if the number of direct descendants of the User-element (CSS expression: User>*) is equal to the number of fields in the user-table (which can be found out with the expression count($user->getTable()->getFieldNames());).

So, I proceeded to write the test found below:

 1  <?php
 2
 3  include(dirname(__FILE__).'/../../bootstrap/functional.php');
 4
 5  $browser = new sfTestFunctional(new sfBrowser());
 6
 7  $user = Doctrine_Query::create()
 8    ->from('User u')->fetchOne();
 9
10  $number_of_fields = count($user->getTable()->getFieldNames());
11
12  $browser->
13    get("/users/$user->id")->
14
15    with('request')->begin()->
16      isParameter('module', 'users')->
17      isParameter('action', 'show')->
18    end()->
19
20    with('response')->begin()->
21      isHeader('Content-Type', 'text/xml; charset=utf-8')->
22      checkElement('User', 1)->
23      checkElement('User>id', $user->id)->
24      checkElement('User>*', $number_of_fields)->
25      isStatusCode(200)->
26    end()
27  ;


In this test I am trying to create my test by a) getting the number of fields on row 10 and b) trying to check if the number of fields in the user-table is equal to the number of direct descendants of the User-element on row 24.

When I run my test it fails on row 24 with this message (line numbering by me):
1. # get /users/5
2. ok 1 - request parameter module is users
3. ok 2 - request parameter action is show
4. ok 3 - response header Content-Type is text/xml; charset=utf-8 (text/xml; charset=utf-8)
5. ok 4 - response selector User matches 1 times
6. ok 5 - response selector User>id matches 5
7. not ok 6 - response selector User>* matches 6 times
8. #     Failed test (./lib/vendors/symfony/lib/test/sfTesterResponse.class.php at line 93)
9. #            got: 0
10. #       expected: 6
11. ok 7 - status code is 200
12. 1..7
13. Looks like you failed 1 tests of 7.                                   


First of all there's an defect in the output generated by checkElement that can be seen on row 7. The defect is that the output gives you the expected count instead of the matched count (in this case the output should be 'not ok 6 - response selector User>* matches 0 times'). This is quite obvious if you compare the match count on row 7 to the value on row 9, which reports 0 as the matched count (which I've checked is correct). I've already reported this as an defect to the symfony project (http://trac.symfony-project.org/ticket/5176).

My question then: is there an alternative way to write this test since checking for the number of direct descendants does not work as expected (as demonstrated above)? Note that I cannot use the selector 'User *' in this test since I am only interested in the direct descendants of User (i.e User > *), not all of its descendants (i.e 'User *').

[Updated on: Mon, 08 December 2008 11:27]

 Topic: [solved] Widget How to display a default value for a textarea?
[solved] Widget How to display a default value for a textarea? [message #67094] Mon, 08 December 2008 14:58
Flashball  is currently offline Flashball
Messages: 127
Registered: January 2008
Location: France
Senior Member
Hello,

I have created a "sfWidgetFormTextarea" widget in my form, and set the default value in the action class with

$widgetFormTextarea->setDefault($content->getBody());


The following code doesn't display the default value:

<?php echo $form_content_presentation['body']->render() ?>


I have logged the widget, and the "default" attribute got the right expected value.

How have I to do to display this default value?

Thanks.

update:
it seems that this code finally works, sorry!

[Updated on: Mon, 08 December 2008 15:43]

 Topic: Testing login, does not work
Testing login, does not work [message #67125] Mon, 08 December 2008 19:44
Seikilos  is currently offline Seikilos
Messages: 609
Registered: May 2008
Location: Germany
Faithful Member
This is the post to the ticket http://trac.symfony-project.org/ticket/5226#preview

I eperience strange behaviour. I have created a login module where the user specifies its name and password and a login is done. One page has the following security settings:

default:
  is_secure: off
 
needLogin:
  is_secure: on
  


The testing code tries first access the needLogin page before a logged in user exists, it works correct, there is a redirect to a login (verified) Then the login is done, a redirect is done (verified), all works. But accessing the needLogin page again with authentification in the test is answered by a 404! This is not the expected behaviour, in the DEV the call to needLogin when auth results in a html text.

This is a part of the test
$browser

    // Trying to access restricted page
        ->info('Accessing a restricted page')
        ->get('tests/needLogin')
        ->isStatusCode(200)
    	->with('request')->begin()
    	->isParameter('module', 'tests')
    	->isParameter('action', 'needLogin')
    	->end()
  
	// Check if it contains a form and loggin
        ->info('Testing login')
        ->with('response')->checkElement('body','/Login/')
        ->setField('login[username]', $username)
        ->setField('login[password]', $password)
        ->click('Login')
        
        ->with('request')->isMethod('post')
        ->info('Test for redirection')
        ->isRedirected()
        ->followRedirect()
        ->isStatusCode(200)
        ->with('request')->begin()
        ->isParameter('module', 'registered')
        ->isParameter('action', 'index')
        ->end()


    // No logged in, test needLogin
        ->info('Testing needLogin to pass')
        ->get('tests/needLogin')
        //->with('request')->debug()
        ->isStatusCode(200)

       // FAIL


prompt output
D:\Webserver\www>symfony test:functional frontend login
> Accessing a restricted page
# get tests/needLogin
ok 1 - status code is "200"
ok 2 - request parameter "module" is "tests"
ok 3 - request parameter "action" is "needLogin"
> Testing login
ok 4 - response selector "body" matches regex "/Login/"
# post /registered/login
ok 5 - request method is "POST"
> Test for redirection
ok 6 - page redirected to "http://localhost/index.php/registered"
ok 7 - status code is "200"
ok 8 - request parameter "module" is "registered"
ok 9 - request parameter "action" is "index"
> Testing needLogin to pass
# get tests/needLogin
not ok 10 - status code is "200"
#     Failed test (D:\Webserver\symfony\lib\test\sfTesterResponse.class.php at line 257)
#            got: 404
#       expected: 200
ok 11 - request parameter "module" is "tests"
ok 12 - request parameter "action" is "needLogin"
> Test for login message
not ok 13 - response selector "body" matches regex "/This page requires login/"
#     Failed test (D:\Webserver\symfony\lib\test\sfTesterResponse.class.php at line 104)
#                     '




    Oops! Page Not Found
    The server returned a 404 response.


Did you type the URL?
  You may have typed the address (URL) incorrectly. Check it to make sure you've got the exact right
 spelling, capitalization, etc.

  Did you follow a link from somewhere else at this site?
  If you reached this page from another part of this site, please email us at [email] so we can corr
ect our mistake.

  Did you follow a link from another site?
  Links from other sites can sometimes be outdated or misspelled. Email us at [email] where you came
 from and we can try to contact the other site in order to fix the problem.

  What's next

    Back to previous page
      Go to Homepage


'
#       doesn't match '/This page requires login/'
1..13
 Looks like you failed 2 tests of 13.



And finally the logfiles, you see at the end, that an unexpected 404 is called
Dec 08 19:09:18 symfony [info] {sfPatternRouting} Connect sfRoute "homepage" (/)
Dec 08 19:09:18 symfony [info] {sfPatternRouting} Connect sfRoute "default_index" (/:module)
Dec 08 19:09:18 symfony [info] {sfPatternRouting} Connect sfRoute "activation" (/register/activate/:activate)
Dec 08 19:09:18 symfony [info] {sfPatternRouting} Connect sfRoute "default" (/:module/:action)
Dec 08 19:09:18 symfony [info] {sfPatternRouting} Match route "homepage" (/) for / with parameters array (  'module' => 'unregistered',  'action' => 'index',)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Match route "default" (/:module/:action) for tests/needLogin with parameters array (  'module' => 'tests',  'action' => 'needLogin',  'sf_culture' => 'en',)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Match route "default" (/:module/:action) for tests/needLogin with parameters array (  'module' => 'tests',  'action' => 'needLogin',  'sf_culture' => 'en',)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Connect sfRoute "homepage" (/)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Connect sfRoute "homepage" (/)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Connect sfRoute "default_index" (/:module)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Connect sfRoute "default_index" (/:module)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Connect sfRoute "activation" (/register/activate/:activate)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Connect sfRoute "activation" (/register/activate/:activate)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Connect sfRoute "default" (/:module/:action)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Connect sfRoute "default" (/:module/:action)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Match route "default" (/:module/:action) for tests/needLogin with parameters array (  'module' => 'tests',  'action' => 'needLogin',)
Dec 08 19:09:20 symfony [info] {sfPatternRouting} Match route "default" (/:module/:action) for tests/needLogin with parameters array (  'module' => 'tests',  'action' => 'needLogin',)
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfFakeRenderingFilter"
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfFakeRenderingFilter"
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfBasicSecurityFilter"
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfBasicSecurityFilter"
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfFakeRenderingFilter"
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfFakeRenderingFilter"
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
Dec 08 19:09:20 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
Dec 08 19:09:20 symfony [info] {registeredActions} Call "registeredActions->executeLogin()"
Dec 08 19:09:20 symfony [info] {registeredActions} Call "registeredActions->executeLogin()"
Dec 08 19:09:20 symfony [info] {sfPHPView} Render "D:\Webserver\www\sandburg\apps\frontend\modules/registered/templates/loginSuccess.php"
Dec 08 19:09:20 symfony [info] {sfPHPView} Render "D:\Webserver\www\sandburg\apps\frontend\modules/registered/templates/loginSuccess.php"
Dec 08 19:09:21 symfony [info] {sfPHPView} Decorate content with "D:\Webserver\www\sandburg\apps\frontend\templates/layout.php"
Dec 08 19:09:21 symfony [info] {sfPHPView} Decorate content with "D:\Webserver\www\sandburg\apps\frontend\templates/layout.php"
Dec 08 19:09:21 symfony [info] {sfPHPView} Render "D:\Webserver\www\sandburg\apps\frontend\templates/layout.php"
Dec 08 19:09:21 symfony [info] {sfPHPView} Render "D:\Webserver\www\sandburg\apps\frontend\templates/layout.php"
Dec 08 19:09:21 symfony [info] {sfPartialView} Render "D:\Webserver\www\sandburg\apps\frontend\templates/_topmenu.php"
Dec 08 19:09:21 symfony [info] {sfPartialView} Render "D:\Webserver\www\sandburg\apps\frontend\templates/_topmenu.php"
Dec 08 19:09:21 symfony [info] {sfWebResponse} Send content (4347 o)
Dec 08 19:09:21 symfony [info] {sfWebResponse} Send content (4347 o)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "homepage" (/)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "default_index" (/:module)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "activation" (/register/activate/:activate)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "default" (/:module/:action)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Match route "default" (/:module/:action) for /registered/login with parameters array (  'module' => 'registered',  'action' => 'login',)
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfFakeRenderingFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
Dec 08 19:09:21 symfony [info] {registeredActions} Call "registeredActions->executeLogin()"
Dec 08 19:09:21 symfony [debug] {sfPropelLogger} exec: SET NAMES 'utf8'
Dec 08 19:09:21 symfony [info] {sfPropelLogger} exec: SET NAMES 'utf8'
Dec 08 19:09:21 symfony [debug] {sfPropelLogger} Binding 1 at position :p1 w/ PDO type PDO::PARAM_INT
Dec 08 19:09:21 symfony [info] {sfPropelLogger} Binding 1 at position :p1 w/ PDO type PDO::PARAM_INT
Dec 08 19:09:21 symfony [debug] {sfPropelLogger} Binding 1 at position :p2 w/ PDO type PDO::PARAM_INT
Dec 08 19:09:21 symfony [info] {sfPropelLogger} Binding 1 at position :p2 w/ PDO type PDO::PARAM_INT
Dec 08 19:09:21 symfony [debug] {sfPropelLogger} Binding 'Samuel' at position :p3 w/ PDO type PDO::PARAM_STR
Dec 08 19:09:21 symfony [info] {sfPropelLogger} Binding 'Samuel' at position :p3 w/ PDO type PDO::PARAM_STR
Dec 08 19:09:21 symfony [debug] {sfPropelLogger} Binding 'e10adc3949ba59abbe56e057f20f883e' at position :p4 w/ PDO type PDO::PARAM_STR
Dec 08 19:09:21 symfony [info] {sfPropelLogger} Binding 'e10adc3949ba59abbe56e057f20f883e' at position :p4 w/ PDO type PDO::PARAM_STR
[Removed DB queries]
Dec 08 19:09:21 symfony [debug] {sfPropelLogger} Binding 1 at position :p1 w/ PDO type PDO::PARAM_INT
Dec 08 19:09:21 symfony [info] {sfPropelLogger} Binding 1 at position :p1 w/ PDO type PDO::PARAM_INT
Dec 08 19:09:21 symfony [debug] {sfPropelLogger} Binding 1 at position :p2 w/ PDO type PDO::PARAM_INT
Dec 08 19:09:21 symfony [info] {sfPropelLogger} Binding 1 at position :p2 w/ PDO type PDO::PARAM_INT
Dec 08 19:09:21 symfony [debug] {sfPropelLogger} Binding 'Samuel' at position :p3 w/ PDO type PDO::PARAM_STR
Dec 08 19:09:21 symfony [info] {sfPropelLogger} Binding 'Samuel' at position :p3 w/ PDO type PDO::PARAM_STR
Dec 08 19:09:21 symfony [debug] {sfPropelLogger} Binding 'e10adc3949ba59abbe56e057f20f883e' at position :p4 w/ PDO type PDO::PARAM_STR
Dec 08 19:09:21 symfony [info] {sfPropelLogger} Binding 'e10adc3949ba59abbe56e057f20f883e' at position :p4 w/ PDO type PDO::PARAM_STR
Dec 08 19:09:21 symfony [info] {myUser} User is authenticated
Dec 08 19:09:21 symfony [info] {myUser} Add credential(s) "user"
Dec 08 19:09:21 symfony [info] {sfFrontWebController} Redirect to "http://localhost/index.php/registered"
Dec 08 19:09:21 symfony [info] {sfWebResponse} Send content (108 o)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "homepage" (/)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "default_index" (/:module)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "activation" (/register/activate/:activate)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "default" (/:module/:action)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Match route "default_index" (/:module) for /registered with parameters array (  'module' => 'registered',  'action' => 'index',)
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfFakeRenderingFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
Dec 08 19:09:21 symfony [info] {registeredActions} Call "registeredActions->executeIndex()"
Dec 08 19:09:21 symfony [info] {registeredActions} Forward to action "default/module"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfFakeRenderingFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
Dec 08 19:09:21 symfony [info] {defaultActions} Call "defaultActions->executeModule()"
Dec 08 19:09:21 symfony [info] {sfPHPView} Render "D:\Webserver\symfony\lib/controller/default/templates/moduleSuccess.php"
Dec 08 19:09:21 symfony [info] {sfPHPView} Decorate content with "D:\Webserver\symfony\lib\controller\default\templates/defaultLayout.php"
Dec 08 19:09:21 symfony [info] {sfPHPView} Render "D:\Webserver\symfony\lib\controller\default\templates/defaultLayout.php"
Dec 08 19:09:21 symfony [info] {sfWebResponse} Send content (2293 o)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "homepage" (/)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "default_index" (/:module)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "activation" (/register/activate/:activate)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Connect sfRoute "default" (/:module/:action)
Dec 08 19:09:21 symfony [info] {sfPatternRouting} Match route "default" (/:module/:action) for tests/needLogin with parameters array (  'module' => 'tests',  'action' => 'needLogin',)
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfFakeRenderingFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfBasicSecurityFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfFakeRenderingFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
Dec 08 19:09:21 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
Dec 08 19:09:21 symfony [info] {defaultActions} Call "defaultActions->executeError404()"
Dec 08 19:09:21 symfony [info] {sfPHPView} Render "D:\Webserver\symfony\lib/controller/default/templates/error404Success.php"
Dec 08 19:09:21 symfony [info] {sfPHPView} Decorate content with "D:\Webserver\symfony\lib\controller\default\templates/defaultLayout.php"
Dec 08 19:09:21 symfony [info] {sfPHPView} Render "D:\Webserver\symfony\lib\controller\default\templates/defaultLayout.php"
Dec 08 19:09:21 symfony [info] {sfWebResponse} Send content (2395 o)



Is this a session managment issue? I cannot spot the problem

[Updated on: Mon, 08 December 2008 19:45]


Debugging is all I doֻ (if these dots are not in line then your screen is broken)
 Topic: embedForms with foreach() based on reference table
embedForms with foreach() based on reference table [message #67149] Tue, 09 December 2008 03:04
camason  is currently offline camason
Messages: 18
Registered: January 2008
Location: Plymouth, UK
Junior Member
Hi all,
I just wanted to share my experiences with embedding forms based on a reference table, which Juro and I have been discussing. This is also using Doctrine.

As an overview, I have 2 separate 'user' tables (User and UserAccount) joined with a many:many join. However, this many:many join also has 3 additional boolean values. This signal the relation between the 2 tables.

For example:

1 UserAccount is linked to 20 users
each of these relations has 3 boolean options.

Any combination of UserAccounts are linked to Users. This relation allows a UserAccount to be friends with a user, with 3 specified booleans (On this occasion, the users and useraccount are Twitter.com members [different purpose for each table], and they 'follow' each other with 3 options. They are co-incidentally 1:1 linked where the exist in both tables).

Example schema:

UserAccount:
  columns:
    id:
      type: integer
    #etc
  relations:
    Users:
      class: User
      foreignAlias: UserAccounts
      refClass: UserAccountFollowUser

User:
  columns:
    id:
      type: integer
    #etc
  relations:
    Users:
      class: User
      foreignAlias: UserAccounts
      refClass: UserAccountFollowUser

UserAccountFollowUser:
  columns:
    user_account_id:
      type: integer
    user_id:
      type: integer
    follow_pref_one:
      type: boolean
    follow_pref_two:
      type: boolean
    follow_pref_three:
      type: boolean
  relations: 
    UserAccount:
      class: UserAccount
      foreign: id
      local: user_account_id
    User:
      class: User
      foreign: id
      local: user_id


(Please ignore the seemingly bad normalisation of the 3 booleans. They are in-fact very constant values, and are named differently.)

At any one point, we will have an instance of a UserAccount, and will want to update all relationships that user has.

Simply passing the UserAccount instance to our sfDoctrine based form will set the $this->object var. In the form's setup, we can then use:

foreach($this->object->UserAccountFollowUser as $index => $relationship)
{
$this->embedForm('relationship' . $index, new UserAccountFollowUserForm($relationship);
}


Important: Ensure that any calls to $this->setValidators() are made BEFORE this->embedForm(). Otherwise, all posted values destined for sub-forms will trigger an extra_field validation error. That precise issue has caused me around 4 hours of pain this-evening. Rolling Eyes

I know that this example is pretty incomplete, but hopefully it will assist anybody searching for a similar task.
 Topic: Doctrine relations question
Doctrine relations question [message #67155] Tue, 09 December 2008 08:04
Enlightened  is currently offline Enlightened
Messages: 21
Registered: September 2008
Location: Russia, Kemerovo
Junior Member

I have `meta` model in doctrine/schema.yml:
meta:
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    model_name: string
    object_id: integer
    page_title: string
    page_keywords: string
    page_description: array


How can I create hasOne() relation from other models with two foreign keys?

I wanna something like
class News
{
  public function setUp()
  {
     $this->hasOne('meta', array('local' => 'id', 'foreign' => [and here two foreign columns, one of them is object_id an another - model_name]);
  }
}

[Updated on: Tue, 09 December 2008 08:05]

 Topic: Form Widget with i18n
Form Widget with i18n [message #67192] Tue, 09 December 2008 15:39
theo.esenwein  is currently offline theo.esenwein
Messages: 42
Registered: February 2007
Member
Hi there.....

Can anyone tell me how to use the FormWidgets with I18N? Any expirence?

Greets
 Topic: [Solved] Problem with i18n 'long version' schema.yml and propel
[Solved] Problem with i18n 'long version' schema.yml and propel [message #67295] Wed, 10 December 2008 12:46
gehasia  is currently offline gehasia
Messages: 28
Registered: June 2008
Location: Bordeaux/France
Junior Member
Hi,

i didn't see any topic on this (i searched the whole 1.2 forum by hand, because search engine gave me no results for 'i18n' search (think the term is too short for the search engine...)).

So i have to use the 'long version' for my i18n table because of naming convention for the DB which use camelCase instead of underscore
(so myTableI18n instead of my_table_i18n). For this reason i can not use the 'short version' (myTable_i18n) which result in an horrible mix between camelCase and underscore...

So here is an sample of my schema for articles table :

  tblArticle:
    _attributes:                     { phpName: tblArticle, isI18N: true, i18nTable: tblArticleI18n }
    id:                              ~
    culture:                         { type: varchar(7), required: true, index: index }
    category_id:                     { type: integer, foreignTable: pltblCategory, foreignReference: id, onDelete: restrict, onUpdate: cascade, required: true }
    author_id:                       { type: integer, foreignTable: sf_guard_user, foreignReference: id, onDelete: restrict, onUpdate: cascade, required: true }
    title:                           { type: varchar(255), required: false }
    slug:                            { type: varchar(255), required: true }
    content:                         { type: longvarchar, required: true }
    created_at:                      ~
    updated_at:                      ~
    is_active:                       { type: boolean, required: true, default: 1 }
    display_author:                  { type: boolean, required: true, default: 0 }

  tblArticleI18n:
    _attributes:                     { phpName: tblArticleI18n }
    id:                              { type: integer, required: true, foreignTable: tblArticle, foreignReference: id, onDelete: cascade, onUpdate: cascade }
    culture:                         { isCulture: true, type: varchar(7), required: true, index: index }
    title:                           { type: varchar(255), required: false }
    content:                         { type: longvarchar, required: true }


Yes there is a 'culture' on the base table but it's only to know the base culture for the article (i could have different 'base culture' in the base articles table). It's not definied as a 'culture' table, and removing it doesn't change anything to the problem.

The problem is while generating the model with propel:build-model i get :
propel > om-template:

[propel-om] Processing: generated-schema.xml
[propel-om] Processing: generated-sfGuardPlugin-schema.xml
[propel-om] Processing Datamodel : JoinedDataModel
[propel-om]   - processing database : propel
[propel-om]     + tblArticle
[propel-om]             -> BasetblArticlePeer [builder: SfPeerBuilder]
Fatal error: Call to a member function getChildrenColumn() on a non-object in /usr/share/php/symfony/plugins/sfPropelPlugin/lib/builder/SfPeerBuilder.php on line 194


I don't see the mistake in my schema, so does anyone have a solution for this please ?

Thanks !

Guillaume

EDIT : It was just a so big silly mistake by me...I think i should had slept the day i wrote that...

For those who wants to laugh Smile :

In my schema the culture for the i18n table should had "primaryKey: true" instead of "index: index". I put index instead of primaryKey because when i first set primareyKey: true (as explained in the documentation) it threw me lots of errors which were resolved with index: index...

And the best thing :
We do have to put the i18n fields in the i18n table only and not in the base table (i put in both here...). i will write that hundred times because it was clearly written in the documentation...
sorry Sad

[Updated on: Fri, 12 December 2008 18:20]

 Topic: symfony 1.2 - Defect in forms framework or not?
symfony 1.2 - Defect in forms framework or not? [message #67318] Wed, 10 December 2008 16:24
joes  is currently offline joes
Messages: 10
Registered: December 2008
Location: Sweden
Junior Member
I am using doctrine and am noticing a strange behaviour with forms, specifically with the bind method in sfForm. I am simply wondering if what I am experiencing (described below) is expected behaviour or not so that I can decide whether or not to create a Ticket.

This is (part) of the schema.yml to provide an idea of the underlying model:

actAs: [Timestampable]
options:
  type: INNODB

UserAttributeValue:
  columns:
    description: string
    value: string(150)


I generate the db, forms, models and a simple crud interface for doctrine. Here's a section of the controller's code relevant for this discussion (generated by doctrine:generate-module-for-route):

<?php

/**
 * user_attribute_values actions.
 *
 * @package    .
 * @subpackage user_attribute_values
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
 */
class user_attribute_valuesActions extends sfActions
{
  public function executeEdit(sfWebRequest $request)
  {
    $this->form = new UserAttributeValueForm($this->getRoute()->getObject());
  }

  public function executeUpdate(sfWebRequest $request)
  {
    $this->form = new UserAttributeValueForm($this->getRoute()->getObject());

    $this->processForm($request, $this->form);

    $this->setTemplate('edit');
  }

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()));
    if ($form->isValid())
    {
      $user_attribute_value = $form->save();

      $this->redirect('@user_attribute_values_edit?id='.$user_attribute_value['id']);
    }
  }
}


I only want the UserAttributeValue->value field to be editable so I edit the generated form so that it contains only the field for editing the value.

Here's an example of the incoming values when submitting the form (i.e values in $request->getParameter($form->getName())):

Array
(
    [id] => 1
    [value] => Test
)


The effect on the row stored in the db when the form is submitted is not quite what I expected.

Row before form is submitted (loaded from fixtures):
mysql> select * from user_attribute_value where id=1\G
*************************** 1. row ***************************
         id: 1
description: Text description
      value: AIK
 created_at: 2008-12-10 16:05:01
 updated_at: 2008-12-10 16:05:01
1 row in set (0.00 sec)


Row after form is submitted:
mysql> select * from user_attribute_value where id=1\G
*************************** 1. row ***************************
         id: 1
description: 
      value: Test
 created_at: NULL
 updated_at: NULL
1 row in set (0.00 sec)


All of the values not provided to form bind are set to null or to their default values (as specified in the db).

Is this to be expected and, if so, what should I do to counter this behaviour?

[Updated on: Thu, 11 December 2008 11:49]

 Topic: symfony permissions with apache
symfony permissions with apache [message #67587] Fri, 12 December 2008 18:10
vortek  is currently offline vortek
Messages: 25
Registered: October 2007
Location: Braga
Junior Member
Hello,

I have symfony installed in a server running plesk.

the symfony installation permissions are:


$ ls -la  /usr/share/pear/

rwxrwxr-x 34 root root  4096 2008-11-27 15:47 symfony



and i have a domain with the permissions:

drwxr-xr-x 19 root psaserv 4096 2008-12-12 15:19 .
drwxr-xr-x  3 root psaserv 4096 2008-12-12 16:09 ..
drwxr-xr-x  8 root psaserv 4096 2008-12-12 14:40 apps
drwxrwxrwx  5 root psaserv 4096 2008-12-12 16:58 cache
drwxr-xr-x  3 root psaserv 4096 2008-12-12 14:52 config
drwxr-xr-x  5 root psaserv 4096 2008-12-12 14:41 data
drwxr-xr-x  4 root psaserv 4096 2008-12-12 14:40 doc
lrwxrwxrwx  1 root psaserv    4 2008-12-12 14:43 httpdocs -> web/
drwxr-xr-x  6 root psaserv 4096 2008-12-12 14:41 lib
drwxrwxrwx  3 root psaserv 4096 2008-12-12 16:05 log
drwxr-xr-x  8 root psaserv 4096 2008-12-12 14:40 plugins
drwxr-xr-x  6 root psaserv 4096 2008-12-12 14:43 .svn
-rwxrwxrwx  1 root psaserv  446 2008-12-12 14:41 symfony
drwxr-xr-x  6 root psaserv 4096 2008-12-12 14:40 test
drwxr-xr-x  7 root psaserv 4096 2008-12-12 15:35 web


When i try to access my index.php it gives:
Fatal error: Uncaught exception 'sfCacheException' with message 'Failed to make 
cache directory "/var/www/vhosts/mydomain.com/cache/admin/dev/config" while 
generating cache for configuration file "config/config_handlers.yml".' in 
/usr/share/pear/symfony/config/sfConfigCache.class.php:337 
Stack trace: 
#0 /usr/share/pear/symfony/config/sfConfigCache.class.php(107): sfConfigCache->writeCacheFile('config/config_h...', '/var/www/vhosts...', '<?php?// auto-g...') 
#1 /usr/share/pear/symfony/config/sfConfigCache.class.php(194): sfConfigCache-
>callHandler('config/config_h...', Array, '/var/www/vhosts...') 
#2 /usr/share/pear/symfony/config/sfConfigCache.class.php(276): sfConfigCache-
>checkConfig('config/config_h...') 
#3 /usr/share/pear/symfony/config/sfConfigCache.class.php(54): sfConfigCache-
>loadConfigHandlers() 
#4 /usr/share/pear/symfony/config/sfConfigCache.class.php(194): sfConfigCache-
>callHandler('config/settings...', Array, '/var/www/vhosts...') 
#5 /usr/share/pear/symfony/config/sfApplicationConfiguration.cl in 
/usr/share/pear/symfony/config/sfConfigCache.class.php on line 337



and the cache looks like this:

$ ls -la cache/
total 116
drwxrwxrwx  5 root   psaserv  4096 2008-12-12 17:21 .
drwxr-xr-x 19 root   psaserv  4096 2008-12-12 15:19 ..
drwxrwxrwx  4 root   psaserv  4096 2008-12-12 14:40 .pear
-rw-r--r--  1 root   root    93722 2008-12-12 17:21 project_autoload.cache
drwxrwxrwx  3 apache apache   4096 2008-12-12 17:18 admin
drwxrwxrwx  6 root   psaserv  4096 2008-12-12 14:43 .svn



This happens because the apache user can't create the files.
I have tryed many combinations of users:groups for both symfony and my project but without luck.

I coded in mac os x with no problem whatsoever.

Any thoughts please?
Thanks

[Updated on: Fri, 12 December 2008 18:24]

 Topic: Problem with inclusion of helper javascript
Problem with inclusion of helper javascript [message #67815] Mon, 15 December 2008 19:28
charagmz  is currently offline charagmz
Messages: 1
Registered: May 2008
Junior Member
I have an action 'newSchedule' and two templates associated with this 'newScheduleSuccess.php, newScheduleConfirm.php' the first relates to a form and the other at a table of confirmation.
In the template of the form I put at the beginning of the file the line '<?php use_helper('Javascript')?>'
and after that I include the following code and run the script
<?php javascript_tag() ?>
if ($('params_repeat').checked) {
//
}
<?php end_javascript_tag() ?>

I get the following error
"$ is not defined
[Break on this error] if ($('params_repeat').checked) {"

And check the "head" of the page and the problem is that no files are being included
sfProtoculousPlugin/js/prototype.js

Doing some testing found that if I use the helper visual_effect somewhere in the template, then the files are loaded

The problem is that it does not load when using the use_helper
 Topic: After 1.2.1 upgrade: doctrine:build-all-reload fails
icon5.gif  After 1.2.1 upgrade: doctrine:build-all-reload fails [message #67828] Tue, 16 December 2008 01:21
nicki78  is currently offline nicki78
Messages: 54
Registered: June 2006
Member
Hi together,

after upgrading from 1.2.0 to 1.2.1 i have problems with

./symfony doctrine:build-all-reload


I receive for every 'object' from my fixtures.yml an error:

Validation error in class XXX


After downgrading to 1.2.0 everything works as expected.
(For upgrading i followed the instructions according to the blog entry.)

Any suggestions?

Nicki
Pages (25): [1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  >  »]

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