Ask your Symfony questions! Pay money and get answers fast! (more info)

What could explain this Doctrine schema bug? Symfony

  • SOLVED

I am suppose to port an old FileMaker Pro database to Symfony/MySql.

I written some PHP scripts to handle the automation. I export from FileMaker Pro as XML, then parse the XML and turn it into yaml for the schema, and SQL to create a MySql table. I use one function for both the mysql field names and the yaml field names, so I can be assured the field names are always the same in both yaml and SQL.

However, the field names in the model is wrong. It is correct in the yaml, but not in the model. I get this error:

500 | Internal Server Error | Doctrine_Record_UnknownPropertyException
Unknown record property / related component "tyear_one_xb_sql" on "OldWinelog"

See the screenshot.

This is the yaml:

OldWinelog:
connection: doctrine
tableName: old_winelog
columns:
found_count_from_tastings_sql: { type: text }
abc_code_sql: { type: text }
alltype_sql: { type: text }
altered_sql: { type: text }
alternate_name_sql: { type: text }
apall_sql: { type: text }
apalph_sql: { type: text }
apcode_sql: { type: text }
appelation_sql: { type: text }
archive_exists_sql: { type: text }
bot_x_two_nd_sql: { type: text }
bot_code_sql: { type: text }
bot_code_b_sql: { type: text }
botsize_sql: { type: text }
bottle_global_sql: { type: text }
case_type_sql: { type: text }
caseimp_sql: { type: text }
caseimp_comma_sql: { type: text }
caseprod_sql: { type: text }
caseprod_comma_sql: { type: text }
cases_calc_sql: { type: text }
category_calc_sql: { type: text }
category_calccard_sql: { type: text }
ccode_sql: { type: text }
ce_date_x_one_x_sql: { type: text }
ce_date_x_two_x_sql: { type: text }
ce_note_x_one_x_sql: { type: text }
ce_note_x_two_x_sql: { type: text }
code_one_x_sql: { type: text }
code_two_x_sql: { type: text }
color_sql: { type: text }
comments_sql: { type: text }
copy_edited_sql: { type: text }
copy_editor_x_one_x_sql: { type: text }
copy_editor_x_two_x_sql: { type: text }
corked_sql: { type: text }
country_sql: { type: text }
country_calc_sql: { type: text }
created_sql: { type: text }
created_by_sql: { type: text }
curprice_sql: { type: text }
current_user_sql: { type: text }
current_user_holder_sql: { type: text }
cycle_sql: { type: text }
date_recvd_sql: { type: text }
donotpub_sql: { type: text }
drink_recom_sql: { type: text }
drink_recom_b_sql: { type: text }
drink_rec_calc_sql: { type: text }
dummy_sql: { type: text }
dupe_checker_sql: { type: text }
dupes_sql: { type: text }
duplicate_sql: { type: text }
early_tasting_sql: { type: text }
edited_sql: { type: text }
ent_by_sql: { type: text }
entered_sql: { type: text }
find_number_sql: { type: text }
finished_sql: { type: text }
flight_sql: { type: text }
flight_b_sql: { type: text }
flight_bottle_sql: { type: text }
flight_global_sql: { type: text }
fullname_sql: { type: text }
gclipboard_sql: { type: text }
global_sql: { type: text }
heading_sql: { type: text }
hot_wine_sql: { type: text }
impcode_sql: { type: text }
importer_sql: { type: text }
insider_sql: { type: text }
insider_copy_sql: { type: text }
insider_issue_sql: { type: text }
insider_volume_sql: { type: text }
issue_sql: { type: text }
issue_b_sql: { type: text }
issue_date_g_sql: { type: text }
label_sql: { type: text }
last_update_sql: { type: text }
late_tasting_sql: { type: text }
latest_note_sql: { type: text }
layout_name_sql: { type: text }
mark_for_output_sql: { type: text }
mod_time_sql: { type: text }
modified_sql: { type: text }
modifier_sql: { type: text }
name_calc_sql: { type: text }
name_calc_vintage_sql: { type: text }
new_releases_text_sql: { type: text }
note_output_sql: { type: text }
note_output_nr_sql: { type: text }
note_output_web_sql: { type: text }
notes_sql: { type: text }
notes_two_x_sql: { type: text }
notes_three_x_sql: { type: text }
notestxt_sql: { type: text }
office_sql: { type: text }
order_sql: { type: text }
original_note_calc_sql: { type: text }
output_note_sql: { type: text }
price_sql: { type: text }
print_note_sql: { type: text }
print_sql: { type: text }
range_holder_sql: { type: text }
rating_sql: { type: text }
rating_two_x_sql: { type: text }
rec_num_sql: { type: text }
recor_id_sql: { type: text }
record_num_curr_sql: { type: text }
regcode_sql: { type: text }
relation_constant_sql: { type: text }
relation_find_sql: { type: text }
reporec_sql: { type: text }
round_price_sql: { type: text }
rt_ok_sql: { type: text }
rtcount_sql: { type: text }
rtmark_sql: { type: text }
rtscore_sql: { type: text }
s_code_sql: { type: text }
sav_rdate_sql: { type: text }
score_sql: { type: text }
score_b_sql: { type: text }
set_up_sql: { type: text }
setup_sql: { type: text }
show_color_sql: { type: text }
specdes_sql: { type: text }
style_sql: { type: text }
subasc_sql: { type: text }
subt_sql: { type: text }
subtype_sql: { type: text }
sysnum_sql: { type: text }
tasc_sql: { type: text }
taste_date_g_sql: { type: text }
taste_date_global_sql: { type: text }
tasted_calc_sql: { type: text }
tasted_twice_sql: { type: text }
tastedate_sql: { type: text }
tastedate_b_sql: { type: text }
taster_sql: { type: text }
taster_b_sql: { type: text }
taster_calc_sql: { type: text }
taster_calc_nr_sql: { type: text }
tastetext_sql: { type: text }
tasting_id_sql: { type: text }
tca_sql: { type: text }
tca_final_sql: { type: text }
tcat_sql: { type: text }
td_sql: { type: text }
td_b_sql: { type: text }
top_x_one_hundred_x_sql: { type: text }
top_x_one_hundred_x_year_sql: { type: text }
total_r_sql: { type: text }
tyear_one_x_sql: { type: text }
tyear_one_x_b_sql: { type: text }
tyear_two_x_sql: { type: text }
tyear_two_x_b_sql: { type: text }
type_sql: { type: text }
vintage_sql: { type: text }
warning_sql: { type: text }
warning_two_x_sql: { type: text }
wcode_sql: { type: text }
web_only_sql: { type: text }
wine_vintage_botsize_name_sql: { type: text }
wine_vintage_botsize_name_auction_sql: { type: text }
winecode_sql: { type: text }
winery_sql: { type: text }
winery_x_two_nd_sql: { type: text }
wineryful_sql: { type: text }
wineryful_x_two_x_sql: { type: text }
wnycode_sql: { type: text }
export_record_id_sql: { type: text }


This is the database table:

mysql> explain old_winelog;
+---------------------------------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------------------------+------------+------+-----+---------+----------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| found_count_from_tastings_sql | text | NO | | NULL | |
| abc_code_sql | text | NO | | NULL | |
| alltype_sql | text | NO | | NULL | |
| altered_sql | text | NO | | NULL | |
| alternate_name_sql | text | NO | | NULL | |
| apall_sql | text | NO | | NULL | |
| apalph_sql | text | NO | | NULL | |
| apcode_sql | text | NO | | NULL | |
| appelation_sql | text | NO | | NULL | |
| archive_exists_sql | text | NO | | NULL | |
| bot_x_two_nd_sql | text | NO | | NULL | |
| bot_code_sql | text | NO | | NULL | |
| bot_code_b_sql | text | NO | | NULL | |
| botsize_sql | text | NO | | NULL | |
| bottle_global_sql | text | NO | | NULL | |
| case_type_sql | text | NO | | NULL | |
| caseimp_sql | text | NO | | NULL | |
| caseimp_comma_sql | text | NO | | NULL | |
| caseprod_sql | text | NO | | NULL | |
| caseprod_comma_sql | text | NO | | NULL | |
| cases_calc_sql | text | NO | | NULL | |
| category_calc_sql | text | NO | | NULL | |
| category_calccard_sql | text | NO | | NULL | |
| ccode_sql | text | NO | | NULL | |
| ce_date_x_one_x_sql | text | NO | | NULL | |
| ce_date_x_two_x_sql | text | NO | | NULL | |
| ce_note_x_one_x_sql | text | NO | | NULL | |
| ce_note_x_two_x_sql | text | NO | | NULL | |
| code_one_x_sql | text | NO | | NULL | |
| code_two_x_sql | text | NO | | NULL | |
| color_sql | text | NO | | NULL | |
| comments_sql | text | NO | | NULL | |
| copy_edited_sql | text | NO | | NULL | |
| copy_editor_x_one_x_sql | text | NO | | NULL | |
| copy_editor_x_two_x_sql | text | NO | | NULL | |
| corked_sql | text | NO | | NULL | |
| country_sql | text | NO | | NULL | |
| country_calc_sql | text | NO | | NULL | |
| created_sql | text | NO | | NULL | |
| created_by_sql | text | NO | | NULL | |
| curprice_sql | text | NO | | NULL | |
| current_user_sql | text | NO | | NULL | |
| current_user_holder_sql | text | NO | | NULL | |
| cycle_sql | text | NO | | NULL | |
| date_recvd_sql | text | NO | | NULL | |
| donotpub_sql | text | NO | | NULL | |
| drink_recom_sql | text | NO | | NULL | |
| drink_recom_b_sql | text | NO | | NULL | |
| drink_rec_calc_sql | text | NO | | NULL | |
| dummy_sql | text | NO | | NULL | |
| dupe_checker_sql | text | NO | | NULL | |
| dupes_sql | text | NO | | NULL | |
| duplicate_sql | text | NO | | NULL | |
| early_tasting_sql | text | NO | | NULL | |
| edited_sql | text | NO | | NULL | |
| ent_by_sql | text | NO | | NULL | |
| entered_sql | text | NO | | NULL | |
| find_number_sql | text | NO | | NULL | |
| finished_sql | text | NO | | NULL | |
| flight_sql | text | NO | | NULL | |
| flight_b_sql | text | NO | | NULL | |
| flight_bottle_sql | text | NO | | NULL | |
| flight_global_sql | text | NO | | NULL | |
| fullname_sql | text | NO | | NULL | |
| gclipboard_sql | text | NO | | NULL | |
| global_sql | text | NO | | NULL | |
| heading_sql | text | NO | | NULL | |
| hot_wine_sql | text | NO | | NULL | |
| impcode_sql | text | NO | | NULL | |
| importer_sql | text | NO | | NULL | |
| insider_sql | text | NO | | NULL | |
| insider_copy_sql | text | NO | | NULL | |
| insider_issue_sql | text | NO | | NULL | |
| insider_volume_sql | text | NO | | NULL | |
| issue_sql | text | NO | | NULL | |
| issue_b_sql | text | NO | | NULL | |
| issue_date_g_sql | text | NO | | NULL | |
| label_sql | text | NO | | NULL | |
| last_update_sql | text | NO | | NULL | |
| late_tasting_sql | text | NO | | NULL | |
| latest_note_sql | text | NO | | NULL | |
| layout_name_sql | text | NO | | NULL | |
| mark_for_output_sql | text | NO | | NULL | |
| mod_time_sql | text | NO | | NULL | |
| modified_sql | text | NO | | NULL | |
| modifier_sql | text | NO | | NULL | |
| name_calc_sql | text | NO | | NULL | |
| name_calc_vintage_sql | text | NO | | NULL | |
| new_releases_text_sql | text | NO | | NULL | |
| note_output_sql | text | NO | | NULL | |
| note_output_nr_sql | text | NO | | NULL | |
| note_output_web_sql | text | NO | | NULL | |
| notes_sql | text | NO | | NULL | |
| notes_two_x_sql | text | NO | | NULL | |
| notes_three_x_sql | text | NO | | NULL | |
| notestxt_sql | text | NO | | NULL | |
| office_sql | text | NO | | NULL | |
| order_sql | text | NO | | NULL | |
| original_note_calc_sql | text | NO | | NULL | |
| output_note_sql | text | NO | | NULL | |
| price_sql | text | NO | | NULL | |
| print_note_sql | text | NO | | NULL | |
| print_sql | text | NO | | NULL | |
| range_holder_sql | text | NO | | NULL | |
| rating_sql | text | NO | | NULL | |
| rating_two_x_sql | text | NO | | NULL | |
| rec_num_sql | text | NO | | NULL | |
| recor_id_sql | text | NO | | NULL | |
| record_num_curr_sql | text | NO | | NULL | |
| regcode_sql | text | NO | | NULL | |
| region_sql | text | NO | | NULL | |
| relation_constant_sql | text | NO | | NULL | |
| relation_find_sql | text | NO | | NULL | |
| reporec_sql | text | NO | | NULL | |
| round_price_sql | text | NO | | NULL | |
| rt_ok_sql | text | NO | | NULL | |
| rtcount_sql | text | NO | | NULL | |
| rtmark_sql | text | NO | | NULL | |
| rtscore_sql | text | NO | | NULL | |
| s_code_sql | text | NO | | NULL | |
| sav_rdate_sql | text | NO | | NULL | |
| score_sql | text | NO | | NULL | |
| score_b_sql | text | NO | | NULL | |
| set_up_sql | text | NO | | NULL | |
| setup_sql | text | NO | | NULL | |
| show_color_sql | text | NO | | NULL | |
| specdes_sql | text | NO | | NULL | |
| style_sql | text | NO | | NULL | |
| subasc_sql | text | NO | | NULL | |
| subt_sql | text | NO | | NULL | |
| subtype_sql | text | NO | | NULL | |
| sysnum_sql | text | NO | | NULL | |
| tasc_sql | text | NO | | NULL | |
| taste_date_g_sql | text | NO | | NULL | |
| taste_date_global_sql | text | NO | | NULL | |
| tasted_calc_sql | text | NO | | NULL | |
| tasted_twice_sql | text | NO | | NULL | |
| tastedate_sql | text | NO | | NULL | |
| tastedate_b_sql | text | NO | | NULL | |
| taster_sql | text | NO | | NULL | |
| taster_b_sql | text | NO | | NULL | |
| taster_calc_sql | text | NO | | NULL | |
| taster_calc_nr_sql | text | NO | | NULL | |
| tastetext_sql | text | NO | | NULL | |
| tasting_id_sql | text | NO | | NULL | |
| tca_sql | text | NO | | NULL | |
| tca_final_sql | text | NO | | NULL | |
| tcat_sql | text | NO | | NULL | |
| td_sql | text | NO | | NULL | |
| td_b_sql | text | NO | | NULL | |
| top_x_one_hundred_x_sql | text | NO | | NULL | |
| top_x_one_hundred_x_year_sql | text | NO | | NULL | |
| total_r_sql | text | NO | | NULL | |
| tyear_one_x_sql | text | NO | | NULL | |
| tyear_one_x_b_sql | text | NO | | NULL | |
| tyear_two_x_sql | text | NO | | NULL | |
| tyear_two_x_b_sql | text | NO | | NULL | |
| type_sql | text | NO | | NULL | |
| vintage_sql | text | NO | | NULL | |
| warning_sql | text | NO | | NULL | |
| warning_two_x_sql | text | NO | | NULL | |
| wcode_sql | text | NO | | NULL | |
| web_only_sql | text | NO | | NULL | |
| wine_vintage_botsize_name_sql | text | NO | | NULL | |
| wine_vintage_botsize_name_auction_sql | text | NO | | NULL | |
| winecode_sql | text | NO | | NULL | |
| winery_sql | text | NO | | NULL | |
| winery_x_two_nd_sql | text | NO | | NULL | |
| wineryful_sql | text | NO | | NULL | |
| wineryful_x_two_x_sql | text | NO | | NULL | |
| wnycode_sql | text | NO | | NULL | |
| export_record_id_sql | text | NO | | NULL | |
| created_at | datetime | NO | | NULL | |
| updated_at | datetime | NO | | NULL | |
+---------------------------------------+------------+------+-----+---------+----------------+
175 rows in set (0.00 sec)



Please notice, in both of these, the field is called tyear_one_x_b_sql. And yet, the Doctrine model is looking for tyear_one_xb_sql. This is a bug in Doctrine, yes? Can anyone think of what might trigger it?

Answers (3)

2010-12-09

Joshua Estes answers:

What are you using to call do make it throw the error, plus I don't see a screenshot.

One thing that may be causing your issues is getTyearOneXbSql() will return tyear_one_xb_sql and getTyearOneXBSql() will return tyear_one_x_b_sql.

Maybe it's just the case is wrong? I'd like to see the stack trace to be sure though.


Lawrence Krubner comments:

Sorry, I forgot the screenshot. It is attached now.

To get this error, I generate a CRUD app like this:

./symfony doctrine:generate-module tastingnotes old_winelog OldWinelog

Then I point my browser at the index action.

I wish I could see a pattern to this bug, because I write a check for it, if there was a pattern.

This or a similar error happened before, and I asked about it before. At that time, the error seemed to arise from numbers like 1 or 2 or 3 being in the field name. So I took out all of the numbers. But here there are no numbers.


Joshua Estes comments:

Try to place an underscore between the X and the B, so call it like TyearOneX_BSql()

I remember this bug from playing with doctrine in the past, it doesn't like it when you have capital letters next to each other like that. I'm not sure if the underscore will solve your issue and I have not looked to see if this is an open issue. I can't remember how I fixed it when I came across this, but I'm pretty sure I changed the column name so everything has 2 or more characters between the underscores. ie tyear_one_x1_b1_sql


Joshua Estes comments:

tyear_two_x_b_sql should experience the same issue, try to rename those to:

<blockquote>
tyear_one_xb_sql
tyear_two_xb_sql
</blockquote>

rebuild all models/classes/form

use getTyearOneXbSql() and getTyearTwoXbSql() respectfully


Lawrence Krubner comments:

Thanks, Joshua. Your advice is good. I may have stated the problem poorly. I realize I can hand-edit the yaml files to fix these issues, but that is not what this project entails. I need to come up with a general rule that I can turn into code. The problem is that the FileMaker Pro database is too large to tweak everything by hand. I won't be around when the final import is done, many months from now, but it is my job to come up with a script that makes the import process as smooth as possible. I can leave a bunch of comments in the code "After you done with the import you will have to tweak the yaml files to remove all of pattern _______". But I'd like to remove that pattern before I create the yaml and sql files, which create the model classes and the table definition.

I suppose I could ensure that there are no single letters surrounded by underscores on both sides?


2010-12-10

Christian Schaefer answers:

hmm.. without looking it up but shouldn't it rather be type: string(255) than type: text ?


Lawrence Krubner comments:

Good catch. It should actually be:

type: string()

The type string() defaults to the largest possible value allowed for the particular RDBMS unless a length is specified.

2010-12-09

Adam Jennison answers:

Hi there, this may be a long shot but I had a similar problem and it was simply due to me having a spelling mistake which I rectified. The model how ever was left in the base folder.
Each time I re-created the model it used the old base file instead. I found and deleted the rouge file from the base folder in the model/doctine/ folder.

I know its a long shot but worth a punt?

Yes, but for some reason a rouge file didn't get deleted, it was after changing the spelling mistake. Like I said, its a long shot but kept me occupied for a few hours!


Lawrence Krubner comments:

I do not understand. Delete the base files? They get overwritten every time I I generate models, yes?