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.
Home » legacy support » symfony 1.1 » 'idservice' could not be found in the field names of type 'fieldName'.
'idservice' could not be found in the field names of type 'fieldName'. [message #65883] Mon, 24 November 2008 18:19 Go to next message
jdotti  is currently offline jdotti
Messages: 13
Registered: November 2008
Junior Member
Hello,

[sorry for my english]
After having generate CRUD forms and class, and after having creating __toString() method, when i try to save a form, i've got this exception :

'idservice' could not be found in the field names of type 'fieldName'. These are: Array
(
[idService] => 0
[service] => 1
[emailService] => 2
)


The service table has this schema in schema.yml
service:
    _attributes: { idMethod: native }
    idService: { type: INTEGER, required: true, autoIncrement: true, primaryKey: true }
    service: { type: VARCHAR, size: '45', required: true }
    emailService: { type: VARCHAR, size: '100' }



Could somebody help me to understand what happen ?

Thanks in advance.
JD
Re: 'idservice' could not be found in the field names of type 'fieldName'. [message #65920 is a reply to message #65883 ] Tue, 25 November 2008 09:49 Go to previous messageGo to next message
Seikilos  is currently offline Seikilos
Messages: 609
Registered: May 2008
Location: Germany
Faithful Member
Sure, its case sensitivity.
idService != idservice in symfony , altough it is in mysql and php.

Where does your problem occur?


Debugging is all I doֻ (if these dots are not in line then your screen is broken)
Re: 'idservice' could not be found in the field names of type 'fieldName'. [message #65924 is a reply to message #65883 ] Tue, 25 November 2008 10:03 Go to previous messageGo to next message
jdotti  is currently offline jdotti
Messages: 13
Registered: November 2008
Junior Member
Hello,

Yes I know, but this result come from model, forms and crud generation, not from my code since i didn't code it ...

I mean that if the generation and so the framework itself has problem at this step, it very difficult to use it and to debug it ...

I paste the schema.yml of the "Service" Table build with command line ...

And i past the error i've got when i try to validate a simple form generate with crud command line...


Yes , the problem come from the case, but it is not me who generate the "idservice" with this case, it is the generator.

Thanks in advance for your help.

JD
Re: 'idservice' could not be found in the field names of type 'fieldName'. [message #65927 is a reply to message #65883 ] Tue, 25 November 2008 10:12 Go to previous messageGo to next message
Seikilos  is currently offline Seikilos
Messages: 609
Registered: May 2008
Location: Germany
Faithful Member
but the generated relies upon your database.yml and the thing is, that you probably should define database table definitions in lowercase and idservice should be id_service
Symfony uses some algorithms to remove the underscore and capitalize the first char of the following words. So a field in a class of a model like idService applies to id_service as a fieldname in the database.

try to rewrite the database.yml


Debugging is all I doֻ (if these dots are not in line then your screen is broken)
Re: 'idservice' could not be found in the field names of type 'fieldName'. [message #65930 is a reply to message #65927 ] Tue, 25 November 2008 10:20 Go to previous messageGo to next message
jdotti  is currently offline jdotti
Messages: 13
Registered: November 2008
Junior Member
Waw, so quick !

Thanks. I will see the databases.yml file and i come back.

Just to be sure :

1/ In the database i've got idService
2/ Int the schema.yml (generate by command), i've got idService

3/ In the BaseService, i've got protected $idservice

4/ In Service forms , i can make crud operation

5/ In Utilisateur forms ( Service has many utilisateur ) , i've got the propel exception i paste before.

[update]
6/with admin generation forms propel:init-admin backend utilisateur Utilisateur, i don't have the exception .

JD

[Updated on: Tue, 25 November 2008 11:33]

Re: 'idservice' could not be found in the field names of type 'fieldName'. [message #66937 is a reply to message #65883 ] Fri, 05 December 2008 21:21 Go to previous messageGo to next message
jdotti  is currently offline jdotti
Messages: 13
Registered: November 2008
Junior Member
Hi,

Finaly i solve my problem with a total rewrite of my database :
- everything in small caps with underscore to separate term : MaTable.MonChamps => matable.mon_champs
- all primary id became id : MaTable.MaTable_id => matable.id
- all foreign key became foreigntable_id => MyTable.MyForeignKey_MaForeignTable => mytable.myforeigntable_id

Then I relaunch generation of schema and forms and everythin h

Very very nice frameworks !

Thanks a lot for your help.

JD
icon3.gif  Final Solution! to "could not be found in the field names of type 'fieldName'. " [message #89957 is a reply to message #65883 ] Mon, 14 December 2009 09:52 Go to previous message
pachinsv  is currently offline pachinsv
Messages: 7
Registered: December 2009
Junior Member
I'm working with symfony 1.4.1

Forget about changing things in routing.yml... I waste 4 hours without a break, searching what was wrong in my code and I found this.

this was the error message:
{PropelException} 'user_id' could not be found in the field names of type 'fieldName'. These are: Array ...

the error was in this file: plugins/sfGuardPlugin/lib/model/pluginSfGuardUser.php (line: 111, for me)

line: $fieldName = sfConfig::get('app_sf_guard_plugin_profile_field_name', 'user_id');

solution: I changed the second parameter for 'id'

Maybe this will help you people. Very Happy

Previous Topic:Symfony Paypal API Integration
Next Topic:Submit form to another action
Goto Forum:
  

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