Skip to content

Instantly share code, notes, and snippets.

View derhansen's full-sized avatar

Torben Hansen derhansen

View GitHub Profile
// The use statements for the fileheader
use MyVendor\MyExtension\Domain\Model\Mymodel;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper;
/**
* Returns all matching records for the given list of uids and applies the uidList sorting for the result
*
plugin.tx_myext_myplugin {
persistence {
storagePid = {$plugin.tx_myext_myplugin.persistence.storagePid}
}
}
plugin.tx_myext_myplugin {
persistence {
# cat=plugin.tx_myext_myplugin//a; type=string; label=Default storage PID
storagePid =
}
}
@derhansen
derhansen / DateTime.php
Last active January 24, 2016 18:12
DateTime for the string 1.1.1 using \DateTime::createfromformat('d.m.Y', '1.1.1')
class DateTime#1 (3) {
public $date =>
string(26) "0001-01-01 19:12:17.000000"
public $timezone_type =>
int(3)
public $timezone =>
string(13) "Europe/Berlin"
}
@derhansen
derhansen / DateTime.php
Created January 24, 2016 18:02
DateTime object for the 01.01.16 using \DateTime::createfromformat('d.m.Y', '1.1.16')
class DateTime#1 (3) {
public $date =>
string(26) "0016-01-01 18:56:23.000000"
public $timezone_type =>
int(3)
public $timezone =>
string(13) "Europe/Berlin"
}
@derhansen
derhansen / DateTime.php
Created January 24, 2016 17:59
DateTime object for the 01.01.2016 using \DateTime::createfromformat('d.m.Y', '01.01.2016')
class DateTime#1 (3) {
public $date =>
string(26) "2016-01-01 18:56:23.000000"
public $timezone_type =>
int(3)
public $timezone =>
string(13) "Europe/Berlin"
}
@derhansen
derhansen / Controller.php
Created January 24, 2016 17:21
Example on how to set the date format of a TYPO3 DatetimeConverter
public function initializeCreateAction()
{
$this->arguments->getArgument('mymodel')
->getPropertyMappingConfiguration()
->forProperty('mydate')
->setTypeConverterOption(
'TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\DateTimeConverter',
DateTimeConverter::CONFIGURATION_DATE_FORMAT,
'd.m.Y'
);
@derhansen
derhansen / ext_typoscript_setup.txt
Created January 17, 2016 19:16
ext_typoscript_setup.txt
config.tx_extbase{
persistence {
classes {
TYPO3\CMS\Extbase\Domain\Model\FrontendUser {
subclasses {
0 = Vendor\Extension\Domain\Model\FrontendUser
}
}
Vendor\Extension\Domain\Model\FrontendUser {
mapping {
@derhansen
derhansen / fe_users.php
Created January 17, 2016 19:15
Add to Configuration/TCA/Overrides
<?php
defined('TYPO3_MODE') or die();
$fields = array (
'deleted' => array(
'exclude' => 1,
'label' => 'Deleted',
'config' => array(
'type' => 'check',
),
<?php
namespace Vender\Extension\Domain\Model;
class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
{
/**
* @var bool
*/