Skip to content

Instantly share code, notes, and snippets.

View beberlei's full-sized avatar
💯

Benjamin Eberlei beberlei

💯
View GitHub Profile
<?php
require_once "ezc/Base/base.php";
require_once "Zend/Loader/Autoloader.php";
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->pushAutoloader(array('ezcBase', 'autoload'), 'ezc');
class EntitySchemaProvider extends Zend_Tool_Framework_Provider_Abstract
<?php
/**
* PHPUnit
*
* Copyright (c) 2002-2009, Sebastian Bergmann <sb@sebastian-bergmann.de>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
abstract class Whitewashing_Webdav_SimplerBackend extends ezcWebdavSimpleBackend
{
protected $liveProperties = array(
'getcontentlength',
'getlastmodified',
'creationdate',
'displayname',
'getetag',
'getcontenttype',
'resourcetype',
<?php
namespace Symfony\CMF\Frontend;
use PHPCR\SessionInterface;
class ContentManager
{
private $session;
@beberlei
beberlei / objectfreezer.patch
Created November 21, 2010 14:02
Patch to solve updating issues
diff --git a/Object/Freezer/Storage/CouchDB.php b/Object/Freezer/Storage/CouchDB.php
index f997e74..26abc11 100644
--- a/Object/Freezer/Storage/CouchDB.php
+++ b/Object/Freezer/Storage/CouchDB.php
@@ -72,6 +72,11 @@ class Object_Freezer_Storage_CouchDB extends Object_Freezer_Storage
protected $port;
/**
+ * @var array
+ */
Using a static OptionSupport class that automatically writes options into properties AND fields extend it.
+ Options are set in the very beginning of the constructor
+ Concise
+ Error if option is not supported
+ Everything is a property, no special treatment of options
+ Good performance
+ Static options can be hidden from public access
- Private properties wouldn't work, access not allowed from parent classes.
@beberlei
beberlei / SimpleObjectHydrator.php
Created March 6, 2011 11:33
Hydrator that performs tasks of BasicEntityPersister.php
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
@beberlei
beberlei / EventManagerBenchmark.php
Created March 7, 2011 19:32
Performance of bschussek/doctrine-common EventManager changes
<?php
require_once "Doctrine/Common/ClassLoader.php";
use Doctrine\Common\ClassLoader;
use Doctrine\Common\EventArgs;
use Doctrine\Common\EventManager;
$loader = new ClassLoader();
$loader->register();
@beberlei
beberlei / form_definitions.php
Created March 17, 2011 12:30
This Symfony Form Experimental Branch example does not use the DIC.
<?php
class MyFormType extends AbstractFormType
{
public function configure(FormBuilder $builder, array $options)
{
$builder->setDataClass("MyProject\FooEntity");
$builder->add('my.sub_form');
$builder->add('text', 'name', array('max_length' => 127, 'id' => 'foo'));
$builder->add('date', 'created');
@beberlei
beberlei / Util.php
Created June 23, 2011 09:25
Controllers as Services revisited
<?php
namespace Whitewashing\BlogBundle\Controller;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
*
*/