Skip to content

Instantly share code, notes, and snippets.

View benjaminrau's full-sized avatar

Benjamin Rau benjaminrau

View GitHub Profile
@benjaminrau
benjaminrau / Scripts.php
Created June 29, 2015 07:47
Fixed buildSubprocessCommand for Expose Beard Patch
/**
* @param string $commandIdentifier E.g. typo3.flow:cache:flush
* @param array $settings The TYPO3.Flow settings
* @param array $commandArguments Command arguments
*
* @return string A command line command ready for being exec()uted
*/
protected static function buildSubprocessCommand($commandIdentifier, $settings, array $commandArguments = array()) {
$subRequestEnvironmentVariables = array(
'FLOW_ROOTPATH' => FLOW_PATH_ROOT,
@benjaminrau
benjaminrau / Example.php
Created June 16, 2015 12:22
TYPO3 Flow IN-Contraint needs array with Persistence Identifiers as $operand due to an Doctrine bug. You are not able to pass a ArrayCollection or other collection containing objects right now. The following helper would replace an operand containing objects with an array containg the identifiers only!
Succeeds:
$portionDemandFrom = $q->matching(
$q->logicalAnd(
$q->lessThanOrEqual('startingFromPersonCount', $this->personCountRange['from']),
$q->in('productCategory', $this->generalUtility->prepareOperandForInExpression($this->getProduct()->getCategories()))
)
)->execute()->getFirst();
Following example would fail:
$portionDemandFrom = $q->matching(
"repositories": [
{
"type": "package",
"package": {
"name": "flowpack/expose",
"version": "1.0",
"source": {
"type": "git",
"url": "http://github.com/mneuhaus/Flowpack.Expose.git",
"reference": "master"
# #
# Security policy for the Cf.Shop package #
# #
resources:
methods:
Cf_Shop: 'method(Cf\Shop\Controller\ShopController->.*Action())'
Cf_Shop_ShopAdmin_Person: 'method(Cf\Shop\Controller\PersonController->.*Action())'
Cf_Shop_ShopAdmin_Order: 'method(Cf\Shop\Controller\OrderController->.*Action())'
// Export Layer Coordinates - Adobe Photoshop Script
// Description: Export x and y coordinates to comma seperated .txt file
// Requirements: Adobe Photoshop CS5 (have not tested on CS4)
// Version: 1.0-beta1.1, 8/31/2011
// Author: Chris DeLuca
// Company: Playmatics
// ===============================================================================
// Installation:
// 1. Place script in
// Mac: '~/Applications/Adobe Photoshop CS#/Presets/Scripts/'
@benjaminrau
benjaminrau / Double2With4DecimalsFormat.php
Last active April 20, 2017 11:06
How to have a tca field of type float/double but nullable
<?php
class Double2With4DecimalsFormat {
function returnFieldJS() {
return '
return value.replace(",", ".");
';
}
function evaluateFieldValue($value, $is_in, &$set) {
if ('' == $value) {
return NULL;
@benjaminrau
benjaminrau / shell_log.txt
Last active August 29, 2015 14:06
Setup virtual machine and typo3 with one command
Benjamin-Rau-iMac:~ benjaminrau$ git clone https://github.com/benjaminrau/devbox && cd devbox && ./up
Cloning into 'devbox'...
remote: Counting objects: 117, done.
remote: Compressing objects: 100% (85/85), done.
remote: Total 117 (delta 19), reused 39 (delta 2)
Receiving objects: 100% (117/117), 32.22 KiB | 0 bytes/s, done.
Resolving deltas: 100% (19/19), done.
Checking connectivity... done
Bringing machine 't3devbox' up with 'virtualbox' provider...
==> t3devbox: Importing base box 'vagrant-debian-wheezy64'...
@benjaminrau
benjaminrau / setup.ts
Created September 15, 2014 11:41
Different wrappers for different csc cTypes
# wrap content elements of main content area
tt_content {
stdWrap.outerWrap.cObject = CASE
stdWrap.outerWrap.cObject {
key.field = colPos
default = TEXT
default.value = |
0 = CASE
0 {
key.field = CType
@benjaminrau
benjaminrau / ext_tables.php
Last active August 29, 2015 14:06
How to enable Context Sensitive Help (CSH)
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
'tx_mamsurvey_domain_model_questionaire',
'EXT:mamsurvey/Resources/Private/Language/locallang_csh_tx_mamsurvey_domain_model_questionaire.xml'
);
Before 6.X:
t3lib_extMgm::addLLrefForTCAdescr(
'tx_mamsurvey_domain_model_questionaire',
'EXT:mamsurvey/Resources/Private/Language/locallang_csh_tx_mamsurvey_domain_model_questionaire.xml'
);
@benjaminrau
benjaminrau / Detail.html
Created September 12, 2014 10:28
Switch news detail view template based on parent category
<f:section name="Main">
<f:if condition="{newsItem}">
<v:switch value="{newsItem.categories -> v:iterator.extract(key: 'parentcategory') -> v:iterator.extract(key: 'uid') -> v:iterator.first() -> v:or(alternative: 0)}">
<v:case case="{v:variable.typoscript(path: 'plugin.tx_mmstemplates.settings.campaignsRootCategoryUid')}" break="TRUE">
<f:render partial="News/Detail/Campaign" section="Main" arguments="{_all}" />
</v:case>
<v:case case="default">
<f:render partial="News/Detail/Default" section="Main" arguments="{_all}" />
</v:case>
</v:switch>