Bug #30925
Reserved field name in MySQL
| Status: | Closed | Start date: | 2011-10-14 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | Scaffolding | |||
| Target version: | - | |||
| Votes: | 0 |
Description
If you use a name from the reserved field names in MySQL (see http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html), a table scaffolded with the extension builder cannot be written. Extension Builder does not output the error (if sqlDebug is on, the error is displayed in the debug frame) and you later will have problems to edit the extension.
Maybe it would be good to implement a check not only for TYPO3 reserved names (like e.g. label), but also for MySQL reserved field names.
History
Updated by Lorenz Ulrich over 1 year ago
A small update on that: From that point on you will also have problems editing the extension, I always get the Exception:
Fatal error: Class 'Tx_ExtensionBuilder_Scaffolding_AbstractScaffoldingController' not found in C:\xampp\htdocs\typo3\artbase\typo3conf\ext\artbase\Classes\Controller\WorkController.php on line 35
(Work was the domain model where I originally wanted to add a field called "group".)
Updated by Nico de Haen over 1 year ago
- Status changed from New to Needs Feedback
It seems you're using an outdated version of the Extension Builder:
1. With the curtrent version you should see a warning like this:
SQL reserved names were found for these properties: Property "group" in Model "Foo". This will result in a different column name in the database. Are you shure, you want to use them?
2. Your controller class inherits from a non existing Scaffolding controller. It might be, that you have to change that manually, since the Extension Builder keeps the inheritances if you enabled edit mode.
Updated by Lorenz Ulrich over 1 year ago
Thanks for your reply.
1. I'm using 2.0.5, the current TER version. I was not correct by telling I wanted to add such a field. I wanted to add a relation called "group". Of course for the relation there's also a DB field with the same way. Maybe Extension Builder only checks for properties with reserved names and not for all kind of fields that might be added to ext_tables.sql.
2. Yes, there was a different problem. My Controllers extended the scaffolding controller, but somehow it doesn't get autoloaded if needed. So I changed it to the ActionController and it works fine.
Updated by Andreas Lappe over 1 year ago
Extremely unimportant, but I have to nitpick on it: it's »sure« not »shure«.
If the code is touched, it'd be nice to have that fixed too…
Updated by Lorenz Ulrich over 1 year ago
Yes, advertising for microphone manufacturers should not be free :-). Also, the comma after "sure" is not needed.
Updated by Nico de Haen over 1 year ago
Hmm, I can't reproduce that. I also get the warning when adding a relation with name "group".
Please try it with a new test extension.
The Extension Builder should create a column named "tx_extkey_group".
Maybe the error is caused by something else?
Updated by Lorenz Ulrich over 1 year ago
Funny, I can't reproduce it either with a new test extension. I get the warning both for properties and relations. Heaven knows why id didn't work with the other extension.
So I think it can be closed. Nevertheless, if you touch the code someday, please correct the orthography :-). Thanks!
Updated by Nico de Haen over 1 year ago
- Status changed from Needs Feedback to Closed