[TYPO3-dev] SQL Error extending fe_users (extension builder)

Dirk Wenzel wenzel at webfox03.de
Mon Aug 26 12:40:02 CEST 2013


Hi,
in an extension I'm working on I got a Domain Model 'User' which should 
extend fe_users by some fields.

There is a plugin 'Users' with this Controller Action combination: 
User=>list,show,new,create,edit,update,delete

When trying to display this plugin I get an exception:

#1247602160: Unknown column 'fe_users.t3ver_state' in 'where clause': 
SELECT COUNT(*) FROM fe_users WHERE fe_users.deleted=0 AND 
fe_users.t3ver_state<=0 AND fe_users.pid<>-1 AND fe_users.hidden=0 AND 
fe_users.starttime<=1377511500 AND (fe_users.endtime=0 OR 
fe_users.endtime>1377511500) AND (fe_users.sys_language_uid IN (0,-1)) 
AND fe_users.pid IN (0) (More information)

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Exception\SqlErrorException thrown 
in file
/opt/typo3_src-6.1.1/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php 
in line 1253.


So, obviously the generated SQL contains fields which do not exist in 
fe_users table. (Pleas see below for details)

Why this?
Many thanks in advance.

Kind regards
Dirk


==================================================
Call stack:
TYPO3\CMS\Extbase\Persistence\Generic\Storage\Exception\SqlErrorException thrown 
in file
/opt/typo3_src-6.1.1/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php 
in line 1253.

57 
TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::checkSqlErrors("SELECT 
  COUNT(*) FROM fe_users  WHERE fe_users.del…ys_language_uid IN (0,-1)) 
AND fe_users.pid IN (0)")


/opt/typo3_src-6.1.1/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php:

00384:    $this->replacePlaceholders($statement, $parameters, 
current($statementParts['tables']));
00385:    $result = $this->databaseHandle->sql_query($statement);

00386:    $this->checkSqlErrors($statement);

00387:    $rows = $this->getRowsFromResult($result);
00388:    $count = current(current($rows));


56 
TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::getObjectCountByQuery(TYPO3\CMS\Extbase\Persistence\Generic\Query)


/opt/typo3_src-6.1.1/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php:

00219:   */
00220:  public function 
getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface 
$query) {

00221:   return $this->storageBackend->getObjectCountByQuery($query);

00222:  }
00223:


55 
TYPO3\CMS\Extbase\Persistence\Generic\Backend::getObjectCountByQuery(TYPO3\CMS\Extbase\Persistence\Generic\Query)


/opt/typo3_src-6.1.1/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php:

00127:   */
00128:  public function 
getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface 
$query) {

00129:   return $this->backend->getObjectCountByQuery($query);

00130:  }
00131:


54 
TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::getObjectCountByQuery(TYPO3\CMS\Extbase\Persistence\Generic\Query)


/opt/typo3_src-6.1.1/typo3/sysext/extbase/Classes/Persistence/Generic/QueryResult.php:

00149:    return count($this->queryResult);
00150:   } else {

00151:    return 
$this->persistenceManager->getObjectCountByQuery($this->query);

00152:   }
00153:  }


53 TYPO3\CMS\Extbase\Persistence\Generic\QueryResult::count()

52 count(TYPO3\CMS\Extbase\Persistence\Generic\QueryResult)


/opt/typo3_src-6.1.1/typo3/sysext/fluid/Classes/ViewHelpers/ForViewHelper.php:

00102:    'index' => 0,
00103:    'cycle' => 1,

00104:    'total' => count($arguments['each'])

00105:   );
00106:


51 TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper::renderStatic(array, 
Closure, TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)


/home/typo3/typo3-6-1/html/typo3temp/Cache/Code/fluid_template/Placements_User_action_list_acdc484245b35381954b664b1ac2fc46644d506d.php:

00175: };
00176:

00177: $output0 .= 
TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper::renderStatic($arguments4, 
$renderChildrenClosure5, $renderingContext);

00178:
00179: $output0 .= '

==================================================
The (generated) ext_typoscript_setup.txt contains:
config.tx_extbase{
     persistence{
         classes{

             TYPO3\Placements\Domain\Model\User {
                 mapping {
                     tableName = fe_users
                     recordType = Tx_Placements_User
                 }
             }

     	}
     }
}

============================================================
To the generated ext_tables.php I added the following lines:
$TCA['fe_users']['columns']['tx_extbase_type']['config']['items'][] = 
array('LLL:EXT:placements/Resources/Private/Language/locallang_db.xlf:fe_users.tx_extbase_type.Tx_Placements_User','Tx_Placements_User');

$TCA['fe_users']['types']['Tx_Placements_User'] = 
$TCA['fe_users']['types']['0'];
$TCA['fe_users']['types']['Tx_Placements_User']['showitem'] .= 
',--div--;LLL:EXT:placements/Resources/Private/Language/locallang_db.xlf:tx_placements_domain_model_user,';
$TCA['fe_users']['types']['Tx_Placements_User']['showitem'] .= '';

Here are the extension builder settings for the domain model 'User':
Object Type: Entity
Is aggregate root: yes
Enable sorting: yes
Map to existing table: fe_users
Default: actions: list,show,edit,new/create,edit/update,delete

Properties Relations:
resumes, applications (own domain objects)




More information about the TYPO3-dev mailing list