Closed esther-86 closed 6 years ago
Took 2 hours to find the fix.
Found after trying to create another plugin to understand the example code in WP MVC. When ran the generate plugin command, got WordPress database error Table 'bitnami_summit.wp_qr_screens_infos' doesn't exist for query
Found out that my DB name had to match the naming scheme. I used DB name QrScreensInfos. It needed to be qr_screens_infos.
New question: What does generate do that allowed this error to show? Maybe have another command to allow these diagnostics to be ran so that these problems regarding naming mismatch can be located more easily?
Some more notes: I think there are bugs because it seems like sometimes the model name will be truncated incorrectly. I tried using model name DemoModel and the name got truncated to just Demo. The table it wanted to wp_demos instead of wp_demo_models.
I saw this issue with models named DemoModel, MyModel
Would welcome a pull request to throw a more actionable error message. Table doesn't exists seems pretty clear to me, but open to better wording. Also be sure to see the example system for events/venues/speakers for guidance.
On 11 December 2017 at 05:41, mysti9uemirage notifications@github.com wrote:
Took 2 hours to find the fix.
Found after trying to create another plugin to understand the example code in WP MVC. When ran the generate plugin command, got WordPress database error Table 'bitnami_summit.wp_qr_screens_infos' doesn't exist for query
Found out that my DB name had to match the naming scheme. I used DB name QrScreensInfos. It needed to be qr_screens_infos.
New question: What does generate do that allowed this error to show? Maybe have another command to allow these diagnostics to be ran so that these problems regarding naming mismatch can be located more easily?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/200#issuecomment-350627533, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV5T9T39K3SaaP7JwPp63fhiRP0yCAks5s_MCRgaJpZM4Q80-w .
Correct, Model or Controller (as appropriate) is part of the name of the class that corresponds to the model or controller.
On 11 December 2017 at 08:14, mysti9uemirage notifications@github.com wrote:
Some more notes: I think there are bugs because it seems like sometimes the model name will be truncated incorrectly. I tried using model name DemoModel and the name got truncated to just Demo. The table it wanted to wp_demos instead of wp_demo_models.
I saw this issue with models named DemoModel, MyModel
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/200#issuecomment-350651306, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV5T-61sVSkufIxXU20yLLotk6DZL_ks5s_OR4gaJpZM4Q80-w .
Yes, table doesn't exists IS very clear and that was what pointed me to finding out that I had a name mismatch. However, what I was trying to say was that I found that out after I got frustrated and ran the generate scaffold command in command line, which isn't very intuitive. Before that, I kept on getting field not found error, when I know the field exists.
I'm actually going to close this request because instead of having naming-convention diagnostic via the command line, I found that being able to debug problems related to naming-conventions is more useful. I created a video on how to debug problems like this here, just in case it helps someone down the road: https://www.youtube.com/watch?v=XIef1H-clMQ&list=PLkrUNq1sQFX7N3BNzg2Xv9T5ijdy05YkC&index=2
Thanks for your contribution.
On 13 December 2017 at 10:04, mysti9uemirage notifications@github.com wrote:
Closed #200 https://github.com/tombenner/wp-mvc/issues/200.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/200#event-1385290671, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV5W-Fog_NM_mk7pBCYQgotVSOBlcIks5s_6E1gaJpZM4Q80-w .
:)
Firstly, thank you for this project. I'm trying to follow the tutorial but my DB table doesn't have an id or a name. My primary key is InfoId and even though I changed in the view's admin's add.php to this code, and anywhere that references id to reference InfoId, I still get Field InfoId not found for use in a form input when I try to add an item in the admin view. What am I not understanding and how do I get over this error? Thank you.