Ask your Symfony questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

What does this generated module render the wrong model? Symfony

So, in Symfony 1.4, I do this:

./symfony doctrine:generate-admin tastingnotes Type --module=type

And yet, it creates a module called "Type" that works from the model "Tastingnotes". Why?

In schema.yml, I have this:

actAs: [Timestampable]
tableName: type
type: integer
primary: true
autoincrement: true
found_count_from_tastings_sql: string(255)
total_r_sql: string(255)
type_sql: string(255)
tastingsname_calc_vintage_sql: string(255)
tastingsscore_sql: string(255)
tastingstastedate_sql: string(255)
tastingstaster_sql: string(255)
tastingswineryful_sql: string(255)
export_record_id_sql: string(255)

Check out the attached screenshot. The form is showing a form appropriate for the TastingNotes model. And also, in the "type" database there are 17,534 records, yet, you can see in the screenshot, no records are shown.


Here is the TastingNotes model:

actAs: { Timestampable: ~ , Taggable: ~ }
tableName: tastingnotes
type: integer
primary: true
autoincrement: true
abc_code_sql: string(255)
alltype_sql: string(255)
altered_sql: string(255)
alternate_name_sql: string(255)
apall_sql: string(255)
apalph_sql: string(255)
apcode_sql: string(255)
appelation_sql: string(255)
archive_exists_sql: string(255)
bot_2nd_sql: string(255)
bot_code_sql: string(255)
bot_code_b_sql: string(255)
botsize_sql: string(255)
bottle_global_sql: string(255)
case_type_sql: string(255)
caseimp_sql: string(255)
caseimp_comma_sql: string(255)
caseprod_sql: string(255)
caseprod_comma_sql: string(255)
cases_calc_sql: string(255)
category_calc_sql: string(255)
category_calccard_sql: string(255)
ccode_sql: string(255)
ce_date_1_sql: string(255)
ce_date_2_sql: string(255)
ce_note_1_sql: clob
ce_note_2_sql: clob
code1_sql: string(255)
code2_sql: string(255)
color_sql: string(255)
comments_sql: string(255)
copy_edited_sql: string(255)
copy_editor_1_sql: string(255)
copy_editor_2_sql: string(255)
corked_sql: string(255)
country_sql: string(255)
country_calc_sql: string(255)
created_sql: string(255)
created_by_sql: string(255)
curprice_sql: string(255)
current_user_sql: string(255)
current_user_holder_sql: string(255)
cycle_sql: string(255)
date_recvd_sql: string(255)
donotpub_sql: string(255)
drink_rec_calc_sql: string(255)
drink_recom_sql: string(255)
drink_recom_b_sql: string(255)
dummy_sql: string(255)
dupe_checker_sql: string(255)
dupes_sql: string(255)
duplicate_sql: string(255)
early_tasting_sql: string(255)
edited_sql: string(255)
ent_by_sql: string(255)
entered_sql: string(255)
find_number_sql: string(255)
finished_sql: string(255)
flight_sql: string(255)
flight_bottle_sql: string(255)
flight_global_sql: string(255)
flight_b_sql: string(255)
fullname_sql: string(255)
gclipboard_sql: string(255)
global_sql: string(255)
heading_sql: string(255)
hot_wine_sql: string(255)
impcode_sql: string(255)
importer_sql: string(255)
insider_sql: string(255)
insider_copy_sql: string(255)
insider_issue_sql: string(255)
insider_volume_sql: string(255)
issue_sql: string(255)
issue_b_sql: string(255)
issue_date_g_sql: string(255)
label_sql: string(255)
last_update_sql: string(255)
late_tasting_sql: string(255)
latest_note_sql: clob
layout_name_sql: string(255)
mark_for_output_sql: string(255)
mod_time_sql: string(255)
modified_sql: string(255)
modifier_sql: string(255)
name_calc_sql: string(255)
name_calc_vintage_sql: string(255)
new_releases_text_sql: string(255)
note_output_sql: clob
note_output_nr_sql: clob
note_output_web_sql: clob
notes_sql: clob
notes2_sql: clob
notes3_sql: clob
notestxt_sql: clob
office_sql: clob
order_sql: string(255)
original_note_calc_sql: string(255)
output_note_sql: string(255)
price_sql: string(255)
print_note_sql: string(255)
print_sql: string(255)
range_holder_sql: string(255)
rating_sql: string(255)
rating2_sql: string(255)
rec_num_sql: string(255)
recor_id_sql: string(255)
record_num_curr_sql: string(255)
regcode_sql: string(255)
region_sql: string(255)
relation_find_sql: string(255)
relation_constant_sql: string(255)
reporec_sql: string(255)
round_price_sql: string(255)
rt_ok_sql: string(255)
rtcount_sql: string(255)
rtmark_sql: string(255)
rtscore_sql: string(255)
s_code_sql: string(255)
sav_rdate_sql: string(255)
score_sql: string(255)
score_b_sql: string(255)
set_up_sql: string(255)
setup_sql: string(255)
show_color_sql: string(255)
specdes_sql: string(255)
style_sql: string(255)
subasc_sql: string(255)
subt_sql: string(255)
subtype_sql: string(255)
sysnum_sql: string(255)
tasc_sql: string(255)
taste_date_global_sql: string(255)
taste_date_g_sql: string(255)
tasted_calc_sql: string(255)
tasted_twice_sql: string(255)
tastedate_sql: string(255)
tastedate_b_sql: string(255)
taster_sql: string(255)
taster_calc_sql: string(255)
taster_calc_nr_sql: string(255)
taster_b_sql: string(255)
tastetext_sql: string(255)
tasting_id_sql: string(255)
tca_sql: string(255)
tca_final_sql: string(255)
tcat_sql: string(255)
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)
tyear1_b_sql: string(255)
tyear2_sql: string(255)
tyear2_b_sql: string(255)
type_sql: string(255)
vintage_sql: string(255)
warning_sql: string(255)
warning2_sql: string(255)
wcode_sql: string(255)
web_only_sql: string(255)
wine_vintage_botsize_name_sql: string(255)
wine_vintage_botsize_name_auction_sql: string(255)
winecode_sql: string(255)
winery_sql: string(255)
winery_2nd_sql: string(255)
wineryful_sql: string(255)
wineryful_2_sql: string(255)
wnycode_sql: string(255)
found_count_from_tastings_sql: string(255)
export_record_id_sql: int(11)
alternate_auction_name_sql: string(255)
average_price_sql: string(255)
cen_sql: string(255)
bot_2nd_request_sql: string(255)
ce_calc_sql: string(255)
cey_sql: string(255)
date_requested_sql: string(255)
early_tasting_id_sql: string(255)
late_tasting_id_sql: string(255)
mark_sql: string(255)
region_for_winery_sql: string(255)
region_for_winery_calc_sql: string(255)
tasting_highlights_sql: string(255)
tasting_id_b_sql: string(255)
tasting_id_g_sql: string(255)
wo_calc_sql: string(255)

Why is the wrong model in use in my newly created module?

[UPDATE]: This is odd. So, check out the new screenshot. If I try to add a new item in the type module, it now correctly shows a form that follows the 'type' model. But on the front page of the type module, it still shows a form that is only appropriate for the 'tastingnotes' module, and it still shows zero records from the database, when there should be over 17.000


Just to be clear, the module is created with the correct name, but it is drawing from the wrong model.

Answers (4)


Micah Breedlove answers:

<blockquote>symfony doctrine:generate-admin [--module="..."] [--theme="..."] [--singular="..."] [--plural="..."] [--env="..."] [--actions-base-class="..."] application route_or_model</blockquote>

So -- if i'm understanding your question -- you're going to want
./symfony doctrine:generate-admin <application name e.g. frontend or backend> <Model Name>

./symfony doctrine:generate-admin frontend Tastingnotes

Which will create


then do the same thing for Type.
:: In summary ::

Breaking that apart:
core of command - ./symfony doctrine:generate-admin
application - frontend
model - Tastingnotes

(if not module name is provided then it will default to the model name in all lower case.)
will create: apps/frontend/modules/tastingnotes

by adding "--module=somethingelse" to the end of the command will create:

If I'm misunderstanding the question or just way off base, please help me by clarifying.

EDITS: cleaned up ugly post

Lawrence Krubner comments:

Here's the thing. I do this:

./symfony doctrine:generate-admin tastingnotes Type --module=type

I'm clearly invoking the Type model. And yet the form that gets created in this new module is Tastingnotes. Why? And how do I create a module that uses the "Type" model?

Is "Type" a reserved keyword for Doctrine? Is that why I'm running into problems?

Micah Breedlove comments:

<blockquote>11/03/10 5:48pm

./symfony doctrine:generate-admin tastingnotes Type --module=type

I'm clearly invoking the Type model. And yet the form that gets created in this new module is Tastingnotes. Why? And how do I create a module that uses the "Type" model?

Is "Type" a reserved keyword for Doctrine? Is that why I'm running into problems?</blockquote>

Type is a reserved word but is tastingnotes the name of the application your using as well as a Model?

Lawrence Krubner comments:

tastingnotes is the name of the application

Lawrence Krubner comments:

and a model. sorry, I did not see your full question. There is a model "tastingnotes" and an application "tastingnotes"

Micah Breedlove comments:

go into
and edit generator.yml

What does model_class read?

Lawrence Krubner comments:

class: sfDoctrineGenerator
model_class: Type
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: type
with_doctrine_route: true
actions_base_class: sfActions

actions: ~
fields: ~
list: ~
filter: ~
form: ~
edit: ~
new: ~

Micah Breedlove comments:

and ./symfony cc doesn't seem to clear up the index of type showing up incorrectly?
can you re-attach the screen shot of the type/index page i cannot seem to find it

Micah Breedlove comments:

I received an email that this question had been updated - but couldn't find any change in the ticket. Are there any new developments?


Aleksandr Nosov answers:

Check the manual for tasks here

I think you forgot something. Check your options like application and model

Lawrence Krubner comments:

I forgot something, but what?


Jakub Zalas answers:

I initialized a fresh 1.4 project and application, copied your schema and generated the model classes.

Than I run:

./symfony doctrine:generate-admin tastingnotes Type --module=type

and the module <em>type</em> was successfully created...

I would check if you have a route named <em>Type</em> as the second parameter for generate-admin task stands for <strong>route</strong> or <strong>model</strong>.

Lawrence Krubner comments:

I also get a module called type. However, it is using the model "tastingnotes" to create the form. The fields in form have nothing to do with the model "type". Even though the module is called "type".


Florian Klein answers:

I would suggest you to put your command line options before arguments:

./symfony doctrine:generate-admin --module="type" tastingnotes Type

instead of

./symfony doctrine:generate-admin tastingnotes Type --module=type