Skip to content

Instantly share code, notes, and snippets.

Working from home

Bastian Waidelich bwaidelich

Working from home
Block or report user

Report or block bwaidelich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mathiasverraes / rollyourown.php
Created May 30, 2018
We don't need no DIC libs / we don't need no deps control
View rollyourown.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.
dimaip / ImageUri.ts2
Created Sep 28, 2016
Handy way to show dummy image if no image is selected
View ImageUri.ts2
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}
View 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 / AbstractTreeRepository.php
Last active Mar 2, 2016
A simple example showing how doctrine behaviours (in this chase (nested) tree and soft-delete) can be used within TYPO3 Flow.
View AbstractTreeRepository.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 {
ekillaby /
Last active Nov 29, 2019
Persistent tree structure using closure table in MySQL

Using closure tables to manage hierarchical relations in MySQL

Create DB tables

Create a table to represent tree nodes.

CREATE TABLE `tree_node` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `data_body` text,
    `node_deleted` datetime DEFAULT NULL,
You can’t perform that action at this time.