Skip to content

Instantly share code, notes, and snippets.

View bwaidelich's full-sized avatar
🏠
Working from home

Bastian Waidelich bwaidelich

🏠
Working from home
View GitHub Profile
@bwaidelich
bwaidelich / FileSizeViewHelper.php
Created June 14, 2013 11:21
FileSizeViewHelper
<?php
namespace Your\Package\ViewHelpers\Format;
/* *
* This script belongs to the TYPO3 Flow package "Your.Package. *
* *
* */
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper;
@bwaidelich
bwaidelich / AbstractTreeRepository.php
Last active March 2, 2016 11:14
A simple example showing how doctrine behaviours (in this chase (nested) tree and soft-delete) can be used within TYPO3 Flow.
<?php
namespace Your\Package\Domain\Repository;
use TYPO3\Flow\Annotations as Flow;
/**
* @Flow\Scope("singleton")
*/
abstract class AbstractTreeRepository extends \Gedmo\Tree\Entity\Repository\NestedTreeRepository implements \TYPO3\Flow\Persistence\RepositoryInterface {
@dimaip
dimaip / ImageUri.ts2
Created September 28, 2016 14:39
Handy way to show dummy image if no image is selected
prototype(Sfi.Site:ImageUri) < prototype(TYPO3.TypoScript:Case) {
image {
condition = ${asset}
renderer = ImageUri {
asset = ${asset}
width = ${width}
height = ${height}
maximumWidth = ${maximumWidth}
maximumHeight = ${maximumHeight}
allowCropping = ${allowCropping}
@mathiasverraes
mathiasverraes / rollyourown.php
Created May 30, 2018 14:17
We don't need no DIC libs / we don't need no deps control
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.