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

Unknown record property Doctrine_Record_UnknownPropertyException Symfony


I try to generate a new module:

./symfony doctrine:generate-admin tastingnotes CurrentLayoutScreenRecreated --module=tasting

When I point my browser at the newly created module, at tastingnotes_dev.php/tasting/index, I get:

500 | Internal Server Error | Doctrine_Record_UnknownPropertyException
Unknown record property / related component "bot2nd_sql" on "CurrentLayoutScreenRecreated"

There is no bot2nd_sql in my schema.yml, but there is a bot_2nd_sql. It's almost as if Symfony is not seeing the first underscore? You look at the stack trace screen shot that I've uploaded - you can see the error develop.

This is what I have in my schema.yml:

actAs: { Timestampable: ~ , Taggable: ~ }
tableName: tastingnotes
type: integer
primary: true
autoincrement: true
name_calc_sql: string(255)
appelation_sql: string(255)
region_sql: string(255)
country_sql: string(255)
specdes_sql: string(255)
color_sql: string(255)
botsize_sql: string(255)
cycle_sql: string(255)
date_requested_sql: string(255)
wineryful_sql: string(255)
winery_sql: string(255)
importer_sql: string(255)
type_sql: string(255)
subt_sql: string(255)
comments_sql: string(255)

order_sql: string(255)
alternate_auction_name_sql: string(255)
bot_2nd_sql: string(255)
bot_2nd_request_sql: boolean
bot_code_sql: string(255)
caseimp_sql: string(255)
caseprod_sql: string(255)
ccode_sql: string(255)
ce_date_1_sql: string(255)
copy_edited_sql: string(255)
copy_editor_1_sql: string(255)
created_sql: string(255)
created_by_sql: string(255)
curprice_sql: string(255)
date_recvd_sql: string(255)
donotpub_sql: boolean
drink_recom_sql: string(255)
flight_sql: string(255)
fullname_sql: string(255)
hot_wine_sql: boolean
insider_sql: boolean
insider_issue_sql: string(255)
issue_sql: string(255)
last_update_sql: string(255)
latest_note_sql: clob
mod_time_sql: string(255)
modified_sql: string(255)
modifier_sql: string(255)
name_calc_sql: string(255)
office_sql: string(255)
price_sql: string(255)
print_note_sql: boolean
rating_sql: string(255)
recor_id_sql: string(255)
rt_ok_sql: boolean
score_sql: string(255)
tasted_twice_sql: boolean
tastedate_sql: string(255)
taster_sql: string(255)
tasting_highlights_sql: string(255)
tasting_id_sql: string(255)
tca_sql: boolean
tca_final_sql: boolean
td_sql: string(255)
td_b_sql: string(255)
top_100_sql: string(255)
top_100_year_sql: string(255)
total_r_sql: string(255)
tyear1_sql: string(255)
tyear2_sql: string(255)
vintage_sql: string(255)
warning2_sql: string(255)
web_only_sql: string(255)

Answers (1)


Jakub Zalas answers:

Try defining an alias:

actAs: { Timestampable: ~ , Taggable: ~ }
tableName: tastingnotes
name: bot_2nd_sql as bot2nd_sql
type: string(255)

This tells doctrine that your column in the database is called <em>bot_2nd_sql</em> and it can be accessed with <em>bot2nd_sql</em>.

If it still doesn't work than I would get rid of number in alias as it is confusing for doctrine:

name: bot_2nd_sql as bot_second_sql