Skip to content

Instantly share code, notes, and snippets.

@jordiwes
jordiwes / gist:4667235
Created January 29, 2013 20:01
Here is my file upload code. You'll notice that the validator is commented out, this is not because it didn't work, it's because I don't need it. It's an internal application and doesn't need any validaiton.
use Zend\File\Transfer\Adapter\Http;
$adapter = new Http();
//$size = new Size(array('min'=>2000)); //minimum bytes filesize
//$adapter->setValidators(array($size), $File['name']);
$options = array("i5_naming" => DB2_I5_NAMING_ON, "i5_libl" => 'WM300DV03D WM300QA03D WM300QA00D TE300QA00D WM300DV03P WM300QA03P WM300ONTP WM300BASP');
$adapter = new Adapter(array(
'driver' => 'IbmDb2',
'platform' => 'IbmDb2',
'platform_options' => array('quote_identifiers' => false),
'database' => '*LOCAL',
'username' => 'PROFILE',
'password' => 'PASSWORD',
'driver_options' => $options
));
PGM PARM(&INSPLF &INJOB &INUSER &INJOBN &INSPLN +
&EXISTS)
/* Thanks to Scott Campbell and Larry Nies */
/* Incoming parms */
DCL VAR(&INSPLF) TYPE(*CHAR) LEN(10)
DCL VAR(&INJOB) TYPE(*CHAR) LEN(10)
DCL VAR(&INUSER) TYPE(*CHAR) LEN(10)
DCL VAR(&INJOBN) TYPE(*CHAR) LEN(6)
# Created by Zend Server
<VirtualHost *:${port}>
# Make ZF2 path available as environment variable
SetEnv ZF2_PATH /usr/local/zendsvr6/share/ZendFramework2/library
# Tell apache to serve index.php if the requested resource doesn't exist.
# This allows static files to be served directly while "ZF-friendly URLS"
# are sent to index.php
<?php
abstract class AbstractValue
{
protected $value;
private function __construct(){}
protected function filter()
{
<?php
namespace Sabel;
abstract class AbstractController
{
protected $diContainer;
public function __construct(DiContainer $diContainer){
$this->diContainer = $diContainer;
}
class ItemsGateway extends AbstractGateway
{
protected $table = 'SCF906';
public function fetchAll()
{
// Try to fetch from the cache first
$response = zend_shm_cache_fetch('itemCodes');
// If itemCodes list isn't in cache
@jordiwes
jordiwes / IbmiToolkit_Module.php
Created September 23, 2015 22:04 — forked from chukShirley/IbmiToolkit_Module.php
ZF2 IBM i Toolkit module
<?php
namespace IbmiToolkit;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
class Module
{
public function onBootstrap(MvcEvent $e)
{
@jordiwes
jordiwes / bootstrap.php
Created December 17, 2015 18:00
bootstrap zend\db into a procedural script
<?php
/**
* bootstrap.php
* Bootstraps an application.
*
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
@jordiwes
jordiwes / LearnAboutYourPHPCLI.sh
Created March 11, 2016 15:52 — forked from phpdave/LearnAboutYourPHPCLI.sh
Learn about your php cli setup
# learn what php-cli is doing
cat /usr/local/zendsvr/bin/php-cli
# learn what configuration values are set
cat /etc/zce.rc
# learn what extensions are enabled in php.ini
cat /usr/local/zendsvr/etc/php.ini | grep extension
# see extensions included
/usr/local/zendsvr/bin/php-cli -r "phpinfo();" | grep conf.d
# things you should probably create for setting up php-cli specific configuration