[TYPO3-mvc] After introducing "tx_extbase_type" my frontend users aren't outputted

Jochen Rau jochen.rau at typoplanet.de
Tue Apr 20 10:48:46 CEST 2010


HI.

On 20.04.10 09:36, Andreas Kießling wrote:
> I think, the check for "type" should be disabled by default, because any
> extension can modify or add such a field and suddenly other extensions
> that relate to that table will fail. If an extension uses or adds that
> field it, than it will surely switch on the check.

The additional field to store the type in is necessary for single table 
inheritance. If many different extensions use the same table to store 
their class data in it, we have to distinguish between the different 
types. And  we have to know about the target type at reconstitution time.

Let's assume we have the following (simplified) structure:

Tx_FirstExt_Client extends Tx_FirstExt_Person
Tx_FirstExt_Employee extends Tx_Firstext_Person

Tx_SecondExt_Member extends Tx_SecondExt_Person

All concrete classes (Tx_FirstExt_Client, Tx_FirstExt_Employeeare, 
Tx_SecondExt_Member) are mapped to the table fe_users.

What objects do you expect if you have

$personRepository = t3lib_div::makeInstance('Tx_FirstExt_PersonRepository');
$persons = $personRepository->findAll();

Of course, you want to retrieve objects of type Tx_FirstExt_Client and 
Tx_FirstExt_Employee and maybe Tx_FirstExt_Person. but you surely don't 
want to get objects of type Tx_SecondExt_Member. So we have to add the 
type field and the following config:

config.tx_extbase {
   persistence{
     classes {
       Tx_FirstExt_Person {
         mapping {
           tableName = fe_users
         }
         subclasses {
           Tx_FirstExt_Client = Tx_FirstExt_Client
           Tx_FirstExt_Employee = Tx_FirstExt_Employee
         }
       }
       Tx_FirstExt_Client {
         mapping {
  		tableName = fe_users
         }
       }
       Tx_FirstExt_Employee {
         mapping {
         	tableName = fe_users
         }
       }
     }
   }
}

Back to your suggestion: IMO it makes sense to implement a switch to 
turn off the type check. This could be done on the query level (like the 
pid check) or the persistence settings (like the 
enableAutomaticCacheClearing switch).

The other problem, which is indeed an issue, is the lack of an API 
function to add/modify settings in the TCA safely. This is not only the 
problem to overwrite the "type" field but also the "items" field of a 
TCA select type.

There is a TODO in the current version of Extbase:

$TCA['fe_groups']['ctrl']['type'] = 'tx_extbase_type'; // TODO handle 
already set 'type'

Any suggestions how to solve this issue?

Regards
Jochen


More information about the TYPO3-project-typo3v4mvc mailing list