Re: [TYPO3-english] Correct use of tablenames field in mm tables
Thank you Dmitry and Thank you Jigal. Now I understand that tablenames is reserved to tables that match the uid_foreign and not for use with tables that match the uid_local. I tried to use a m:1 tables logic and it was developed to use 1:m tables logic. 2011/6/21 Jigal van Hemert ji...@xs4all.nl: Hi Guillermo, On 20-6-2011 15:43, Guillermo R. Oramas J. wrote: You said: Although it can work the column tablenames is usually meant for a different situation: I still don't understand why my example doesn't match the purpose for which the tablenames column was done. I should have put it a bit differently. I meant to explain that the mm-tables were meant as a connection between one table and one or more other tables. If I understood your construction correctly you wanted to use an mm-table as a general connection between all kinds of records. In the TYPO3 situation the tablenames column contains the name of the table where the records with uid = uid_foreign can be found. The table of the records where the uid_local refers to is defined in the TCA. For every relationship (even if this is with records of more than one table) you should have a separate mm-table. With bidirectional MM-relations things get more complicated. In the 'select' section of the TCA documentation you can read more details. http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.3.0/view/4/2/#id2522688 -- Kind regards / met vriendelijke groet, Jigal van Hemert. ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Re: [TYPO3-english] Correct use of tablenames field in mm tables
Hi Guillermo, On 20-6-2011 15:43, Guillermo R. Oramas J. wrote: You said: Although it can work the column tablenames is usually meant for a different situation: I still don't understand why my example doesn't match the purpose for which the tablenames column was done. I should have put it a bit differently. I meant to explain that the mm-tables were meant as a connection between one table and one or more other tables. If I understood your construction correctly you wanted to use an mm-table as a general connection between all kinds of records. In the TYPO3 situation the tablenames column contains the name of the table where the records with uid = uid_foreign can be found. The table of the records where the uid_local refers to is defined in the TCA. For every relationship (even if this is with records of more than one table) you should have a separate mm-table. With bidirectional MM-relations things get more complicated. In the 'select' section of the TCA documentation you can read more details. http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.3.0/view/4/2/#id2522688 -- Kind regards / met vriendelijke groet, Jigal van Hemert. ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Re: [TYPO3-english] Correct use of tablenames field in mm tables
Hello Jigal. Thank you for your very well explained answer. You said: Although it can work the column tablenames is usually meant for a different situation: I still don't understand why my example doesn't match the purpose for which the tablenames column was done. 2011/6/18 Jigal van Hemert ji...@xs4all.nl: Hi, On 17-6-2011 18:48, Guillermo R. Oramas J. wrote: Like an example I have these three tables: customers, suppliers and countries. [...] I understand this: The first row means that supplier1 is in germany. The second row means that customer1 is also in germany. Although it can work the column tablenames is usually meant for a different situation: There are three kinds of clients, each has its own table (because some fields are different): - tx_myext_persons - tx_myext_companies - tx_myext_organisations There is also a table of lawyers and you need to store which clients are represented by a lawyer: - tx_myext_lawyers - tx_myext_mm_lawyers_clients In this last table lawyer with uid=3 has clients: - 3 (person), 4 (person) - 3 (company), - 5 (organisation) In tx_myext_mm_lawyers_clients this is stored as: uid_local | uid_foreign | tablenames 3 | 3 | tx_myext_persons 3 | 4 | tx_myext_persons 3 | 3 | tx_myext_companies 3 | 5 | tx_myext_organisations So it's a relation of one field with records from more than one table. But I already have doubts: ¿Is it necessary some TCA configuration in order to TYPO3 understand the relations? Yes, look at the TCA documentation of the 'group' type [1]. internal_type must be 'db' allowed must list the tables which can be linked (tx_myext_persons,tx_myext_companies,tx_myext_organisations) MM must contain the name of the mm-table The documentation of the 'select' type [2] also provides good information. ¿Is possible to setup it from Kickstarter? To some extend, yes. If you select 'True MM relations' and select 'all tables' for the table you link the data from the kickstarter will set: allowed = '*', You can change that later to the desired tables. But at least the mm-table is generated, etc. ¿Is necessary to set an index for the tablenames field? If there are loads of relations it can speed up queries. [1] http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.3.0/view/4/2/#id2525241 [2] http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.3.0/view/4/2/#id2522688 -- Kind regards / met vriendelijke groet, Jigal van Hemert. ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Re: [TYPO3-english] Correct use of tablenames field in mm tables
Hi! Guillermo R. Oramas J. wrote: Could you explain a bit in depth this?: You can do it like this but it would be better to have separate mm tables in this case. You have three tables that you need to relate. That is best done through two separate tables. Well, you have three regular tables. Two of them are related to one table. There is no point to use a single MM relation table in such case because it only adds complexity. Here is what you should have: Table2 == uses == table2_table1_mm == Table1 Table3 == uses == table3_table1_mm == Table2 And no 'tablenames' column in use. Depends on your TCA configuration. It is best if you read about MM relations in the TYPO3 core API doc. It describes MM relations well. It would be too much text here to describe it. Here is the link for you: http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.3.0/view/4/2/#id2522688 Look down the page from that point. -- Dmitry itoldyou Dulepov TYPO3 coresecurity team member E-mail: dmitry.dule...@typo3.org Web: http://dmitry-dulepov.com/ ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Re: [TYPO3-english] Correct use of tablenames field in mm tables
Hi! Guillermo R. Oramas J. wrote: ¿Is it correct? You can do it like this but it would be better to have separate mm tables in this case. You have three tables that you need to relate. That is best done through two separate tables. I understand this: The first row means that supplier1 is in germany. The second row means that customer1 is also in germany. Depends on your TCA configuration. But I already have doubts: ¿Is it necessary some TCA configuration in order to TYPO3 understand the relations? Yes. ¿Is possible to setup it from Kickstarter? Yes. There is a checkbox True MM relations. ¿Is necessary to set an index for the tablenames field? Not necessary but good to have. It would be faster. I would do KEY select01 (uid_local,uid_foreign). -- Dmitry itoldyou Dulepov TYPO3 coresecurity team member E-mail: dmitry.dule...@typo3.org Web: http://dmitry-dulepov.com/ ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Re: [TYPO3-english] Correct use of tablenames field in mm tables
Hi, On 17-6-2011 18:48, Guillermo R. Oramas J. wrote: Like an example I have these three tables: customers, suppliers and countries. [...] I understand this: The first row means that supplier1 is in germany. The second row means that customer1 is also in germany. Although it can work the column tablenames is usually meant for a different situation: There are three kinds of clients, each has its own table (because some fields are different): - tx_myext_persons - tx_myext_companies - tx_myext_organisations There is also a table of lawyers and you need to store which clients are represented by a lawyer: - tx_myext_lawyers - tx_myext_mm_lawyers_clients In this last table lawyer with uid=3 has clients: - 3 (person), 4 (person) - 3 (company), - 5 (organisation) In tx_myext_mm_lawyers_clients this is stored as: uid_local | uid_foreign | tablenames 3 | 3 | tx_myext_persons 3 | 4 | tx_myext_persons 3 | 3 | tx_myext_companies 3 | 5 | tx_myext_organisations So it's a relation of one field with records from more than one table. But I already have doubts: ¿Is it necessary some TCA configuration in order to TYPO3 understand the relations? Yes, look at the TCA documentation of the 'group' type [1]. internal_type must be 'db' allowed must list the tables which can be linked (tx_myext_persons,tx_myext_companies,tx_myext_organisations) MM must contain the name of the mm-table The documentation of the 'select' type [2] also provides good information. ¿Is possible to setup it from Kickstarter? To some extend, yes. If you select 'True MM relations' and select 'all tables' for the table you link the data from the kickstarter will set: allowed = '*', You can change that later to the desired tables. But at least the mm-table is generated, etc. ¿Is necessary to set an index for the tablenames field? If there are loads of relations it can speed up queries. [1] http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.3.0/view/4/2/#id2525241 [2] http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.3.0/view/4/2/#id2522688 -- Kind regards / met vriendelijke groet, Jigal van Hemert. ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Re: [TYPO3-english] Correct use of tablenames field in mm tables
Hi. Thank you for the explication. Like an example I have these three tables: customers, suppliers and countries. CUSTOMERS -- | uid | customer | -- |1 | customer1 | -- SUPPLIERS | uid | supplier | |1 | supplier1 | COUNTRIES --- | uid | country | --- |5 | germany | --- Some customers and suppliers have offices in many countries, so is a mm relationship. I build a mm table that looks like this: --- | uid_local | uid_foreign | tablenames | sorting | --- |1 | 5 | suppliers| 1 | --- |1 | 5 | customers | 1 | --- ¿Is it correct? I understand this: The first row means that supplier1 is in germany. The second row means that customer1 is also in germany. But I already have doubts: ¿Is it necessary some TCA configuration in order to TYPO3 understand the relations? ¿Is possible to setup it from Kickstarter? ¿Is necessary to set an index for the tablenames field? Thanks in advance. 2011/6/16 Dmitry Dulepov dmitry.dule...@gmail.com: Hi! Guillermo R. Oramas J. wrote: I noticed there is a field tablenames that is used in the mm tables. I looked for information but it appears that there is not much. I have two very similar tables that have a mm relation with a third table, so I created two mm tables, but I guess that with this tablenames is possible to have only one. Could someone guide me through the correct use of that field? That field is used when you can have a relation from one record type to many other record types in one field. For example, FE users has relation to FE groups. If we used MM relations there, it would be one record type and table names is not necessary. Now imagine you have a shop and user has a wishlist. Goods are in different tables depending on the good type. But the wish list must be able to reference any good. So you need table names in the MM table to know what good it is. If there were no table names, you would have to have a separate MM table for each good type, which is not good if you want to add a new type or do efficient selects. -- Dmitry itoldyou Dulepov TYPO3 coresecurity team member E-mail: dmitry.dule...@typo3.org Web: http://dmitry-dulepov.com/ ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Re: [TYPO3-english] Correct use of tablenames field in mm tables
Hi! Guillermo R. Oramas J. wrote: I noticed there is a field tablenames that is used in the mm tables. I looked for information but it appears that there is not much. I have two very similar tables that have a mm relation with a third table, so I created two mm tables, but I guess that with this tablenames is possible to have only one. Could someone guide me through the correct use of that field? That field is used when you can have a relation from one record type to many other record types in one field. For example, FE users has relation to FE groups. If we used MM relations there, it would be one record type and table names is not necessary. Now imagine you have a shop and user has a wishlist. Goods are in different tables depending on the good type. But the wish list must be able to reference any good. So you need table names in the MM table to know what good it is. If there were no table names, you would have to have a separate MM table for each good type, which is not good if you want to add a new type or do efficient selects. -- Dmitry itoldyou Dulepov TYPO3 coresecurity team member E-mail: dmitry.dule...@typo3.org Web: http://dmitry-dulepov.com/ ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
[TYPO3-english] Correct use of tablenames field in mm tables
Hello. I noticed there is a field tablenames that is used in the mm tables. I looked for information but it appears that there is not much. I have two very similar tables that have a mm relation with a third table, so I created two mm tables, but I guess that with this tablenames is possible to have only one. Could someone guide me through the correct use of that field? Thanks a lot. ___ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english