Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathias Petermann peschmae

View GitHub Profile
@peschmae
peschmae / right way
Created Aug 8, 2014
Charset Conversion
View right way
ALTER TABLE <TABLENAME> CHANGE <COLUMNNAME> <COLUMNNAME> VARCHAR(255) CHARACTER SET latin1;
ALTER TABLE <TABLENAME> CHANGE <COLUMNNAME> <COLUMNNAME> VARBINARY(255);
ALTER TABLE <TABLENAME> CHANGE <COLUMNNAME> <COLUMNNAME> VARCHAR(255) CHARACTER SET utf8;
View loadUserSession
<?php
/**
* Loads a user session
* @param string $sessionId
*
* @return boolean
*/
public function loadUserSession($sessionId) {
$this->feUserAuth->id = $sessionId;
$this->feUserAuth->fetchSessionData();
View TransactionRepository.php
/**
* Finds incompleted transactions for a user. Used to have only one single
* transaction.
*
* @param $customerId
* @internal param string $customerNumber
* @return Tx_Extbase_Persistence_QueryResultInterface
*/
public function findIncompleteByCustomerId($customerId) {
$query = $this->createQuery();
@peschmae
peschmae / gist:3781226
Created Sep 25, 2012
inline printf ViewHelper
View gist:3781226
<f:format.printf arguments="{number: '{singleDigitToDisplayWithLeadingZero}'}">%1$02d</f:format.printf>
How can that be written inline?
Possible Workaround (Ugly, since we need to set the format in the controller)
Controller:
<?php
$this->view->assign('monthFormat', '%1$02d');
?>
View:
{monthFormat-> f:format.printf(arguments: {1:'{singleDigitToDisplayWithLeadingZero}'})}