[TYPO3-mvc] Re: Create predefined fe_groups when activating extension
NGUYEN Duc Quan
quan at apart.lu
Thu Dec 3 14:46:40 CET 2015
Hi David,
ok, thanks for your reply. When I implement the code this way and call the controller I get this error message:
( ! ) Fatal error: Call to a member function get() on null in /home/vagrant/Projects/aform/typo3conf/ext/apartcoachingclub/Classes/Controller/UserGroupCreationController.php on line 15
This is probably because at time of the activation of the extension the repository is unknown?
I ended up using Chris solution:
---
Hi Duc Quan,
as said before, i would place naked mysql-queries into the file ext_tables.sql (create new if not exist):
INSERT INTO fe_groups (title)
VALUES ('myDummyGroup');
and
UPDATE fe_groups SET title='myNewGroup' where uid=1;
After installation of your extension (and/or (re)activation) the myDummyGroup will be inserted into your database.
with the update-query you will get definately fe_group with uid=1 to have the wanted title.
the queries of course depend on the state of your T3-installation. If there is no fe_group before, the above statements will leave one record with wanted name in db. If thre are fe_groups already in the db, the dummy-record will be added and the fe_group with uid=1 will get a new title.
If there is a former fe_group with uid=1 in the db which has been deleted, the queries will FAIL.
There are better queries under
http://stackoverflow.com/questions/1361340/how-to-insert-if-not-exists-in-mysql
kr
Chris
---
Thanks a lot to both of you to expand my knowledge :)
More information about the TYPO3-project-typo3v4mvc
mailing list