Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Created by PhpStorm.
* User: lucius
* Date: 19.10.16
* Time: 16:49
*/
namespace Concrete\Package\BasicTablePackage\Src\DiscriminatorEntry;
@outoftime
outoftime / jquery.capture.js
Last active September 12, 2020 19:45
Handle events in the capturing phase with jQuery. Probably has bugs.
$.fn.capture = function(eventName) {
var selector, handler;
if (arguments.length === 2) {
handler = arguments[1];
} else {
selector = arguments[1];
handler = arguments[2];
}
@jasperkuperus
jasperkuperus / DiscriminatorListener.php
Last active July 7, 2023 17:35
This gist shows you how to define your discriminator maps at child level in doctrine 2. Why? Because your parent class shouldn't be aware of all it's subclasses. Please read my article for more explanation: https://medium.com/@jasperkuperus/defining-discriminator-maps-at-child-level-in-doctrine-2-1cd2ded95ffb
<?php
namespace My\Namespace;
/**
* This Listener listens to the loadClassMetadata event. Upon this event
* it hooks into Doctrine to update discriminator maps. Adding entries
* to the discriminator map at parent level is just not nice. We turn this
* around with this mechanism. In the subclass you will be able to give an
* entry for the discriminator map. In this listener we will retrieve the
* load metadata event to update the parent with a good discriminator map,