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

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$9
What does this generated module render the wrong model?

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:




Type:
actAs: [Timestampable]
tableName: type
columns:
id:
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.

Why?

Here is the TastingNotes model:

Tastingnotes:
actAs: { Timestampable: ~ , Taggable: ~ }
tableName: tastingnotes
columns:
id:
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


[UPDATE]:

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

attachment image asker uploaded image

Lawrence Krubner | 11/03/10 at 5:15pm Edit
Tutorial: How to assign prize money

Previous versions of this question: 11/04/10 at 1:47pm | 11/11/10 at 12:05pm | 11/17/10 at 5:47pm

The experts have suggested, on average, a prize of $4 for this question.

(14) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    11/03/10
    5:40pm
    Micah Breedlove says:

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


    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

    apps/frontend/modules/tastingnotes

    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:
    apps/frontend/modules/somethingelse
    --------------------


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


    EDITS: cleaned up ugly post

    Previous versions of this answer: 11/03/10 at 5:34pm | 11/03/10 at 5:38pm | 11/03/10 at 5:38pm | 11/03/10 at 5:40pm

  • avatar
    Last edited:
    11/03/10
    5:34pm
    Aleksandr Nosov says:

    Check the manual for tasks here http://www.symfony-project.org/reference/1_4/en/16-Tasks#chapter_16_sub_doctrine_generate_admin

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

  • avatar
    Last edited:
    11/03/10
    6:20pm
    Jakub Zalas says:

    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 type was successfully created...

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

  • avatar
    Last edited:
    11/04/10
    5:08am
    Florian Klein says:

    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

  • avatar
    Last edited:
    11/03/10
    5:48pm
    Lawrence Krubner says:

    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?

  • avatar
    Last edited:
    11/03/10
    5:48pm
    Lawrence Krubner says:

    I forgot something, but what?

  • avatar
    Last edited:
    11/03/10
    5:53pm
    Micah Breedlove says:

    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?


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

  • avatar
    Last edited:
    11/04/10
    11:12am
    Lawrence Krubner says:

    tastingnotes is the name of the application

  • avatar
    Last edited:
    11/04/10
    11:13am
    Lawrence Krubner says:

    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".

  • avatar
    Last edited:
    11/04/10
    11:14am
    Lawrence Krubner says:

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

  • avatar
    Last edited:
    11/04/10
    1:04pm
    Micah Breedlove says:

    go into
    apps/tastingnotes/modules/type/config
    and edit generator.yml

    What does model_class read?

  • avatar
    Last edited:
    11/04/10
    1:59pm
    Lawrence Krubner says:

    generator:
    class: sfDoctrineGenerator
    param:
    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

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






  • avatar
    Last edited:
    11/04/10
    2:12pm
    Micah Breedlove says:

    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

  • avatar
    Last edited:
    11/13/10
    1:37pm
    Micah Breedlove says:

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

This question has expired.





Current status of this question: Community pot



Please log in to add additional discourse to this page.





Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.