Skip to content

Instantly share code, notes, and snippets.

Working from home

Bastian Waidelich bwaidelich

View GitHub Profile
View AuthenticationContext.php
namespace Some\Package\Security;
use Neos\Cache\CacheAwareInterface;
use Neos\Flow\Annotations as Flow;
* @Flow\Scope("singleton")
bwaidelich / main.go
Last active Jan 31, 2019
Golang Value Object tests
View main.go
package main
import (
// EmailAddress Value Object
type EmailAddress string
bwaidelich / Root.fusion
Created Jan 15, 2019
Atomic Fusion: Content with TOC
View Root.fusion
prototype(Some.Package:Component.ContentWithToc) < prototype(Neos.Fusion:Component) {
blocks = Neos.Fusion:RawArray
renderer = afx`
<Neos.Fusion:Collection collection={props.blocks} itemName="block" @children="itemRenderer">
<a href={'#c-' + iterator.cycle}>{block.label}</a>
bwaidelich / MainMenuItems.fusion
Created Jan 4, 2019
Fusion based Menu implementation for Neos CMS
View MainMenuItems.fusion
prototype(Some.Package:MainMenuItems) < prototype(Neos.Fusion:Component) {
renderer = Neos.Fusion:RawCollection {
collection = ${q(site).children('[instanceof Neos.Neos:Document]').get()}
@context.rootline = ${q(documentNode).parents('[instanceof Neos.Neos:Document]').get()}
itemName = 'node'
itemRenderer = Some.Package:Component.Organism.Menu.Item {
title = ${q(node).property('title')}
href = Neos.Neos:NodeUri {
node = ${node}
bwaidelich / Component_Atom_DefaultElement.fusion
Last active Sep 5, 2018
Atomic Fusion based Form Definition
View Component_Atom_DefaultElement.fusion
prototype(My.Package:Form.DefaultElement) < prototype(Neos.Fusion:Component) {
id = ''
name = ''
label = ''
value = null
isRequired = false
properties = Neos.Fusion:RawArray
validationErrors = Neos.Fusion:RawArray
bwaidelich / rollyourown.php
Created Jun 7, 2018 — forked from mathiasverraes/rollyourown.php
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.
bwaidelich / Routes.yaml
Created May 11, 2018
Neos Flow routing "remaining URL segments"
View Routes.yaml
uriPattern: '{@action}/{segments}.html'
'@package': 'Some.Package'
'@controller': 'SomeController'
'@action': 'index'
'@format': 'html'
handler: 'Some\Package\Routing\SegmentsRoutePart'
bwaidelich / SomeCommandController.php
Created Mar 13, 2018
Neos Flow CLI Command to process entities in batches
View SomeCommandController.php
namespace Some\Package\Command;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
class SomeCommand extends CommandController
bwaidelich / ExampleEvent.php
Created Jun 1, 2017
Flow EventSourcing: Use Value Objects as Event Payload / ReadModel primary keys
View ExampleEvent.php
namespace Some\Package
use Neos\EventSourcing\Event\EventInterface;
final class ExampleEvent implements EventInterface
* @var UserId
bwaidelich / FacetViewHelper.php
Created Mar 31, 2017
Simple ViewHelper to create facet filter links (without filling up the Routing Cache) Raw
View FacetViewHelper.php
namespace Wwwision\Test\ViewHelpers\Link;
use Neos\FluidAdaptor\Core\ViewHelper\AbstractTagBasedViewHelper;
use Neos\FluidAdaptor\Core\ViewHelper;
* Simple ViewHelper to create facet filter links
* Usage:
You can’t perform that action at this time.