Skip to content

Instantly share code, notes, and snippets.

@vixe76
vixe76 / docker-compose.yml
Created January 30, 2020 19:36 — forked from seanhandley/docker-compose.yml
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:

What's the difference between cascade="remove" and orphanRemoval=true in Doctrine 2

TLDR: The cascade={"remove"} is like a "software" onDelete="CASCADE", and will remove objects from the database only when an explicit call to $em->remove() occurs. Thus, it could result in more than one object being deleted. orphanRemoval can remove objects from the database even if there was no explicit call to ->remove().

I answered this question a few times to different people so I will try to sum things up in this Gist.

Let's take two entities A and B as an example. I will use a OneToOne relationship in this example but it works exactly the same with OneToMany relationships.

class A
@vixe76
vixe76 / AbstractRestController.php
Created July 2, 2019 12:51 — forked from albe/AbstractRestController.php
Automagic RESTful API for https://github.com/neos/flow Framework Aggregates (incomplete)
<?php
namespace Acme\Api\Controller;
use Acme\Api\Domain\Repository\ResourceRepository;
use Acme\Api\Utility\AggregateReflectionHelper;
use Acme\Api\Utility\ResourceTypeHelper;
use Acme\Api\Utility\ViewConfigurationHelper;
use Doctrine\Common\Inflector\Inflector;
# basic pfctl control
# ==
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
@vixe76
vixe76 / SomeCommandController.php
Created April 30, 2019 10:11 — forked from bwaidelich/SomeCommandController.php
Neos Flow CLI Command to process entities in batches
<?php
declare(strict_types=1);
namespace Some\Package\Command;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
class SomeCommand extends CommandController
{
@vixe76
vixe76 / AuthenticationContext.php
Created April 30, 2019 10:10 — forked from bwaidelich/AuthenticationContext.php
Dynamic ACL in Neos Flow
<?php
declare(strict_types=1);
namespace Some\Package\Security;
use Neos\Cache\CacheAwareInterface;
use Neos\Flow\Annotations as Flow;
/**
* @Flow\Scope("singleton")
*/
@vixe76
vixe76 / imapsync.md
Created March 5, 2018 19:27 — forked from peterkraume/imapsync.md
Migrate typo3.org emails with homebrew and imapsync
  1. Install Homebrew (if you haven't yet): https://brew.sh/
  2. Install imapsync: brew install imapsync
  3. Sync your mails:
imapsync \
--host1 mail.nine.ch --ssl1 --user1 YOUR.NAME@typo3.org --password1 XXXXX \
--host2 mail.typo3.org --ssl1 --user2 YOUR.NAME@typo3.org --password2 YYYYY
@vixe76
vixe76 / composer.json
Created November 5, 2017 18:52 — forked from helhum/composer.json
The (currently) ideal TYPO3 composer setup
{
"require": {
"typo3-console/composer-auto-setup": "^0.1",
"georgringer/news": "^6.1",
"helhum/typo3-secure-web": "^0.2.5",
"typo3/cms-introduction": "^3.0"
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
@vixe76
vixe76 / Menu.html
Created April 13, 2017 12:28 — forked from bwaidelich/Menu.html
A DTO that can be used to create simple menus in a TYPO3 Flow application
<ul class="nav">
<f:for each="{menu.menuItems}" as="menuItem">
<f:render section="menuItem" arguments="{menuItem: menuItem}" />
</f:for>
</ul>
<f:section name="menuItem">
<f:if condition="{menuItem.header}">
<f:then>
<li class="nav-header">{menuItem.label}</li>
@vixe76
vixe76 / DispatchComponent.php
Created March 23, 2017 14:58 — forked from bwaidelich/DispatchComponent.php
A custom implementation of the default TYPO3.Flow DispatchComponent that allows for redirecting to a configurable URI upon access denied exceptions
<?php
namespace Wwwision\Test\Mvc;
/* *
* This script belongs to the TYPO3 Flow package "Wwwision.Test". *
* *
* */
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Http\Component\ComponentChain;