[TYPO3-german] Extbase - createQuery - statement Problem

Silke Capo s.capo at digital-worx.de
Tue Mar 10 14:42:06 CET 2015


Hallo Christian,

ich wollte auch einen Zugriff auf die fe_users haben. In meiner 
Extension musste ich dazu folgende Schritte vornehmen:

Unter Domain/Models ein Model angelegt (weil ich zusätzliche Felder 
genutzt habe:
/**
  * User Model
  *
  * 	 * @validate StringLength(minimum=6, maximum=15)
  *
  */
class Users extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser {

	/**
	 * @var string
	 */
	protected $passwordOld = '';

...

	/**
	 * __construct
	 */
	public function __construct() {
		 parent::__construct();	
	}

	/**
	 * Sets the $passwordOld value
	 *
	 * @param string $passwordOld
	 * @return void
	 * @api
	 */
	public function setPasswordOld($passwordOld) {
		$this->passwordOld = $passwordOld;
	}

	/**
	 * Returns the $passwordOld value
	 *
	 * @return string
	 * @api
	 */
	public function getPasswordOld() {
		return $this->passwordOld;
	}

...

}

Wichtig hier: von Frontenduser ableiten, nicht von der allgemeinen Klasse.

Deine zusätzlichen Felder als Variablen, + getter und setter.

Dann das Repository:
/**
  * The repository for Users
  */
class UsersRepository extends 
\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository {
...
}

Hier musst du nur dann etwas eintragen, wenn du spezielle 
Datenbankabfragen brauchst, die normalen wie "findAll" funktionieren 
automatisch. Auch hier wieder von FrontendUser ableiten!

Dann unter Configuration/TypoScript noch das Mapping:
in setup.txt:
config.tx_extbase {
	persistence {
		classes {
			DigitalWorx\DxSpecialistsearch\Domain\Model\Users {
				mapping {
					tableName = fe_users
					recordType =
				}
			}
		}
	}
}

plugin.tx_dxspecialistsearch {
	persistence {
		classes {
			
			DigitalWorx\DxSpecialistsearch\Domain\Model\User {
				mapping {
						tableName = fe_users
				}
			}
		}
		...
	}
...
}

In ext_tables.php:

/**
  * Table configuration fe_users
  */
$tempColumns = array (
	'password_old' => array (
		'exclude' => 1,
		'label' => 
'LLL:EXT:dx_specialistsearch/Resources/Private/Language/locallang_db.xlf:fe_users.password',
		'config' => array (
			'type' => 'input',
			'size' => 30,
			'eval' => 'string',
			'readOnly' => 1,
			'default' => ''
		)
	),
);
$fields = 'password_old';

\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('fe_users');

if (version_compare(TYPO3_branch, '6.2', '<')) {
	\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $tempColumns, 1);
} else {
	\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $tempColumns);
}

so hat es bei mir geklappt.

VG Silke

On 10.03.2015 14:12, typo3-german-request at lists.typo3.org wrote:
> Message: 9
> Date: Tue, 10 Mar 2015 13:24:18 +0100
> From: Christian Leicht<usenet at schani.com>
> Subject: [TYPO3-german] Extbase - createQuery - statement Problem
> To:typo3-german at lists.typo3.org
> Message-ID:<mailman.7264.1425990285.623.typo3-german at lists.typo3.org>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> Hallo,
> ich hab noch ne Frage zu meinem gestrigen Problem. Will aber nicht
> wieder ?ber Extbase herziehen;-)  Deswegen ein neuer Post
>
> Also, ich muss in einer Extension auf die fe_user DB zugreifen. Dazu
> habe ich mir in meiner extension im repository Ordner

-- 
     -------------------------------------
     digital worx GmbH
     Schulze-Delitzsch-Str. 16
     70565 Stuttgart
     Tel. 0711 220 40 93 0
     Fax. 0711 220 40 93 44
     capo at digital-worx.de
     http://www.digital-worx.de
     -------------------------------------
     Geschaeftsfuehrer:
     Sven Rahlfs
     Mirko Ross
     HRB 22 5281 Amtsgericht Stuttgart
     USt.-Id. Nr.: DE218401190
     -------------------------------------
     Unseren Blog finden Sie unter:
     http://think.digital-worx.de


More information about the TYPO3-german mailing list