Skip to content

Instantly share code, notes, and snippets.

View woutsanders's full-sized avatar
💭
I may be slow to respond.

woutsanders

💭
I may be slow to respond.
View GitHub Profile
@woutsanders
woutsanders / autoloadPSR0.php
Last active August 29, 2015 13:56 — forked from adriengibrat/l.php
A very quick PSR-0 SPL autoloader function
<?php
//set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__); // optional
spl_autoload_register(function ($class) {
$file = preg_replace('#\\\|_(?!.+\\\)#','/', $class) . '.php';
if (stream_resolve_include_path($file)) {
require $file;
}
@woutsanders
woutsanders / DoctrineReference.yml
Last active August 29, 2015 14:20 — forked from mnapoli/reference.yml
Holds common Doctrine relation and field definitions
# Inspired from http://blog.hio.fr/2011/09/17/doctrine2-yaml-mapping-example.html
MyEntity:
type: entity
repositoryClass: MyRepositoryClass
table: my_entity
namedQueries:
all: "SELECT u FROM __CLASS__ u"
# Class-Table-Inheritance
@woutsanders
woutsanders / MenuBuilder.php
Last active February 15, 2020 08:46
Knp Menu Bundle with the Metronic Admin Theme 4 sidebar menu http://bit.ly/2bfd2JS Couldn't have done it without this earlier, successful, attempt for Twitter Bootstrap: https://gist.github.com/nateevans/9958390. Rendered example: http://imgur.com/a/9LfZq If you are going to use this, make sure you have a valid license for the template!
<?php
namespace AppBundle\Menu;
use Knp\Menu\FactoryInterface;
/* Please note, this is a test with made up items */
class MenuBuilder {
private $factory;