0

I'm trying to create a new extension with two tables : Alert with 3 fields : title (string type) content (relation -> we must be able to select a content in the back office) news (relation -> we must be able to select a news from the existing table tx_news_domain_model_news)

AlertUserMM (this table is used to link the Alert table and the User table) Alert (relation with the table Alert) User (relation with the table fe_users)

Here is my extension builder

When I want to save it, I have few errors :

Warning! The configuration for table "pages" is not compatible with extbase. You have to configure it yourself if you want to map to this table (Error 606)

For this error, I can you to save anyway or not

When i delete the relation with the table pages, I have the Typo3 error :

Argument 1 passed to EBT\ExtensionBuilder\Domain\Model\ClassObject\MethodParameter::setTypeHint() must be of the type string, null given, called in /home/dev/rta/htdocs/typo3conf/ext/extension_builder/Classes/Service/ClassBuilder.php on line 394

I don't know where is the probleme, anyone has an idea ?


UPDATE

Here is my extension builder

I managed to make my extension, so I modified my typoscript like this to map the "pages" table:

config.tx_extbase {
  persistence {

    enableAutomaticCacheClearing = 1
    updateReferenceIndex = 0

    classes {

      Ewill\EwillAlerte\Domain\Model\Contenu {
        mapping {
          tableName = pages
          recordType = Tx_EwillAlerte_Contenu
          columns {
                uid.mapOnProperty = uid
                title.mapOnProperty = title
                sorting.mapOnProperty = sorting
          }
        }
      }

      Ewill\EwillAlerte\Domain\Model\Actualite {
        mapping {
          tableName = tx_news_domain_model_news
          recordType = Tx_EwillAlerte_Actualite
        }
      }

      Ewill\EwillAlerte\Domain\Model\Utilisateur {
        mapping {
          tableName = fe_users
          recordType = Tx_EwillAlerte_Utilisateur
        }
      }

    }
  }
}

But when I install my extension in the extension manager, I have this error :

[SQL Error] line 0, col 22: Error: Expected BIT, TINYINT, SMALLINT, MEDIUMINT, INT, INTEGER, BIGINT, REAL, DOUBLE, FLOAT, DECIMAL, NUMERIC, DATE, TIME, TIMESTAMP, DATETIME, YEAR, CHAR, VARCHAR, BINARY, VARBINARY, TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB, TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT, ENUM, SET, or JSON, got ';' in statement: CREATE TABLE pages ( );

I have to modify my ext_tables.sql ? With only the fields that I map in my typoscript ? Is there anything else to add? Any particular syntax?

Zuyuute
  • 19
  • 2
  • There are some open issues related to simular errors: https://github.com/FriendsOfTYPO3/extension_builder/issues - maybe you find something that helps. – Tobias Gaertner May 03 '21 at 12:12
  • BTW you don't need to create `MM` model manually. While creating *many-to-many* relation between User and Alert it should create mm table and coresponding TCA config itself. – biesior May 03 '21 at 12:21
  • Thanks @TobiasGaertner, I will check this ! – Zuyuute May 03 '21 at 14:52
  • @biesior I think I need this table because I use it to know if a user has seen an alert or not. If he has seen it, then I remove the line (this is the instruction of my tutor). Also, I don't know how it creates itself if I don't specify somewhere the tables to link. And if I let it create itself, I could still do a delete operation? – Zuyuute May 03 '21 at 14:55
  • If you create a relation between User and Alert table as "m:n" then the extensionbuilder automatically creates this table. They way you deal with this in an object orientend environment (like extbase) is: you get your User object and your Alert object and do something like "$user->removeAlert($alert);" - Create the relation and have a look at the generated Models. – Tobias Gaertner May 04 '21 at 05:31
  • Ok I did what you said but when I save my extension and I go in my extension manager, I have a **syntax error, unexpected ','** so I can't install it (I verified that I don't have this error without my new extension files) – Zuyuute May 04 '21 at 08:42
  • (Update : I fixed the syntax error! However, I have not yet manually configured the mapping to the pages table.) – Zuyuute May 04 '21 at 09:01
  • Keep in mind that in TYPO3 the `pages` table is considered as *too generic* therefore it doesn't contain its model. Instead you should fetch its data separately as an array and work with it in your controller or pass it to the view. If it is important to map anyway you can use TS config to write these mappings [using mapOnProperty](https://docs.typo3.org/m/typo3/book-extbasefluid/9.5/en-us/6-Persistence/4-use-foreign-data-sources.html) – biesior May 04 '21 at 11:09
  • In your design you are using `Content` for the model name, but during mapping trying to use `Ewill\EwillAlerte\Domain\Model\Contenu` is that a bug? – biesior May 04 '21 at 14:19
  • Also, if you are gonna to access pages of all types (not only your `Content` model), comment/remove this from config: `recordType = Tx_EwillAlerte_Contenu` otherwise it will select only records you created as this relation exactly. – biesior May 04 '21 at 14:21
  • It's not a bug, it's because I translated my variables into French ! I will try this. I have nothing to add in my ext_tables.sql ? (The error seems to refer to the declaration of the table) – Zuyuute May 04 '21 at 15:23
  • You cannot use English names in one place and French in another... If you changed names during creating the ext I'd suggest investigating that the generated version uses the same name in different places. – biesior May 04 '21 at 15:30
  • I changed the names before creating the extension! I had translated at the beginning when taking a screenshot to (maybe) make my variables more understandable. I will edit my post with my actual extension – Zuyuute May 04 '21 at 21:04

0 Answers0