Skip to content

Instantly share code, notes, and snippets.

View TomHAnderson's full-sized avatar
🏠
Working from home

Tom H Anderson TomHAnderson

🏠
Working from home
View GitHub Profile
@TomHAnderson
TomHAnderson / ormdriverchain.config.php
Created February 15, 2012 20:16
Adding a path to orm_driver_chain
'orm_driver_chain' => array(
'parameters' => array(
'drivers' => array(
'application_annotation_driver' => array(
'paths' => array(
APPLICATION_PATH . '/modules/plugins/Attachments/src/Attachments/Entity',
)
)
)
)
public function checkPaths($e) {
$response = $e->getTarget()->getResponse();
$return = '';
$errors = array();
// Check directories
$checkDirs = array(
'Session Save Path' => session_save_path(),
'Upload Temp' => ini_get('upload_tmp_dir'),
'Search' => APPLICATION_PATH . '/data/Search/',
@TomHAnderson
TomHAnderson / gist:2853492
Created June 1, 2012 16:46
Service Manager Exception
Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotCreatedException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for foo' in /private/var/www/soliant/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:294
Stack trace:
#0 /private/var/www/soliant/ZendSkeletonApplication/module/Install/Module.php(23): Zend\ServiceManager\ServiceManager->get('foo')
#1 [internal function]: Install\Module->onBootstrap(Object(Zend\Mvc\MvcEvent))
#2 /private/var/www/soliant/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(463): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#3 /private/var/www/soliant/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('bootstrap', Object(Zend\Mvc\MvcEvent), Array)
#4 /private/var/www/soliant/ZendSkeletonApplication
Add to module/Application/config/module.config.php
'di' => array(
'instance' => array(
'alias' => array(
'idx' => 'Application\Controller\IndexController'
),
),
),
@TomHAnderson
TomHAnderson / gist:2859348
Created June 2, 2012 17:53
Singly profile returns extra characters
<?php
namespace Singly\Model;
use Zend\Http\Client,
Zend\Json\Json,
Singly\Module;
class Singly {
public function takelogin($code) {
$navigation = $view->getBroker()->load('navigation')->getPluginLoader();
$navigation->registerPlugin('name', 'module\View\Helper\HelperClass');
@TomHAnderson
TomHAnderson / gist:3777671
Created September 24, 2012 19:05
Session Manager DI
'Zend\Session\SessionManager' => array(
'parameters' => array(
'saveHandler' => 'Application\Session\SaveHandler\Doctrine',
),
),
@TomHAnderson
TomHAnderson / gist:4080702
Created November 15, 2012 19:33
Default Routing
'router' => array(
'routes' => array(
'default' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/[:controller[/][/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
@TomHAnderson
TomHAnderson / gist:4081065
Created November 15, 2012 20:30
Parsing a view templete and returning result
public function infiniteScroll($page) {
$view = $this->getServiceLocator()->get('View');
$model = new ViewModel();
$model->setTemplate('scripts/infinite-scroll/main.phtml');
$model->setVariable('page', $page);
$model->setOption('has_parent', true);
return $view->render($model);
}
<?php
namespace Db\Form\InputFilter;
trait Field
{
abstract public function inputFilterInput();
}