Skip to content

Instantly share code, notes, and snippets.

View robzienert's full-sized avatar

Rob Zienert robzienert

View GitHub Profile
<?php
/**
* Enhancements to Zend_Db_Table
* @author Hector Virgen
*
* @see http://www.virgentech.com/blogs/view/id/4
*/
////require_once 'Zend/Db/Table/Abstract.php';
CREATE PROCEDURE MoveSubtree
(IN my_root CHAR(2), IN new_parent CHAR(2))
LANGUAGE SQL
DETERMINISTIC
BEGIN ATOMIC
DECLARE origin_lft INTEGER;
DECLARE origin_rgt INTEGER;
DECLARE new_parent_rgt INTEGER;
SELECT lft, rgt
class Prpl_Form extends Zend_Form
{
/**
* Init
*
*/
public function init()
{
$this->addPrefixPath('Prpl_Form', 'Prpl/Form');
$this->addElementPrefixPath('Prpl', 'Prpl');
@robzienert
robzienert / Module bootstrap
Created October 20, 2010 13:48
This bootstrap process doesn't seem correct.
<?php
class Sites_Bootstrap extends Zend_Application_Module_Bootstrap
{
public function initResourceLoader()
{
$loader = $this->getResourceLoader();
$loader->addResourceType('helper', 'helpers', 'Helper');
}
protected function _initHelpers()
<?php
class Metra_Controller_Router_Route_GlamourSite extends Zend_Controller_Router_Route_Abstract
{
/**
* @var Project_Controller_Router_Route_GlamourSite
*/
private static $_instance;
/**
* @var string
<?php
class Entity
{
protected $_ruleSet;
public function __construct([..], RuleSet $ruleSet = null)
{
$this->_ruleSet = $ruleSet
}
Irdeto\Portal\Model\AbstractPortlet:
type: mappedSuperclass
table: portal_page_portlets
inheritanceType: SINGLE_TABLE
discriminatorColumn:
name: name
type: string
length: 255
discriminatorMap:
portlet: Irdeto\Portal\Entity\Portlet
<?php
class FooController extends Zend_Controller_Action
{
public function listAction()
{
$usersAndStuff = $model->getUsersAndStuff();
$this->view->users = $this->getUsersAndStuff();
}
<?php
class FooPlugin extends \Zend_Controller_Plugin_Abstract
{
public function preDispatch(\Zend_Controller_Request_Abstract $request)
{
$request->setControllerName('foo')
->setActionName('bar')
->setDispatched(false);
}
@robzienert
robzienert / gist:1177942
Created August 29, 2011 07:28
CalendarBundle arch refactor
<?php
// Project: CalendarBundle
// Goal: Speed up development and reduce bugs by abandoning dev. of
// PHP iCalendar RFC implementation. Use vetted scripts like RiDoc (Ruby)
// or dateutil (Python) as a base.
//
// This code illustrates a vertical slice of the class architecture up to
// the service layer.
$processor = \Processor\Factory::create($container->get('CalendarBundle.processor_driver'));