Escaping Zend_Form Error Element Labels in ZF1
Problem:You have a form element label with extra characters (e.g. *, ", :, etc...) and you want to escape or remove it in the generated error message.Example Zend Form Element:$firstName = new...
View ArticleNotes In Resolving Conflict on GIT Rebase
So after doing git rebase master from a featured branch or some other branch you get a conflict.Here are some notes on resolving.After getting the conflict, you will be redirected to temporary branch...
View ArticleLEFT JOIN that acts as an OUTER JOIN
If your LEFT JOIN is acting up like an OUTER JOIN or is joining everything on the RIGHT table but this is not your intended purpose, make sure that your LEFT table's foreign key is set to NULL for it...
View ArticleAccess SSL Enabled URL via Curl
Sometimes you may have problems accessing URL that are SSL enabled. The solution is to simply set the flags below: $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch,...
View ArticleHow to Fix SSHFS Mounts Not Writable by PHP
Problem:When accessing a php file in the browser that uses is_writable(), is_dir(),... etc of a mounted directory through sshfs, PHP sometimes cannot detect the mounted directory so the functions above...
View Articleinstall fastcgi
sudo apt-get update && sudo apt-get install libapache2-mod-fastcgi sudo a2enmod fastcgi
View ArticleComposer Update/Install
Dont install require-dev packages (--no-dev), prefer the distribution packages (--prefer-dist), maximum verbosity (-vvv), show profiles such as memory usage and time (--profile) php composer.phar...
View ArticleTip: How to Add Timestamp With CURRENT_DATETIME in Doctrine 2 ORM
Assuming that your database profiler is Mysql: /** * @ORM\Column(type="datetime", nullable=false) * @ORM\Version * @var string */ protected $creationTimestamp;The above declaration should produce:...
View ArticleHow to use ZF2's Curl Http Adapter with Header information
Just sharing some of my painful WTF experiences using ZF2's Curl Http client adapter so you wont have to deal with my headaches.Basically I am trying to send a CURL_HTTPHEADER with these params.This is...
View ArticleAutomagic Mod_Vhost_Alias for Vagrant precise PHP
Just sharing my Apache vhost to enable automatic virtual hosting for my development environment.This will enable anything you put to '/vagrant/www/*' a vhost with a public directory. Useful if you are...
View ArticleHow to use ZF2's Service Manager Factories with Constructor Based Objects...
Say you have a manufacturer that produces books and you have multiple new instances of books with different title being manufactured. How would you do this via the Service Manager?Your book factory...
View ArticleHow to delete missing files and add new files in Subversion
Add:svn add * --force Delete:svn st | grep ^! | awk '{print " --force "$2}' | xargs svn rmReference:http://stackoverflow.com/questions/9600382/svn-command-to-delete-all-locally-missing-files
View ArticleHow to Pass the ServiceManager to Forms and Taking Advantage of the init()
Seems pretty easy and its also documented in the ZF2 docs but I think its worth repeating here.In short, when creating forms by extending the Form object it is a good practice to create your elements...
View ArticleHow to Create a Custom ZF2 ServiceManager Plugin?
If you want to discover how a ServiceManager Plugin gets initialized go here:http://www.franzdeleon.me/2013/09/how-does-servicemanager-plugin-get.htmlSo how do we register our own custom ServiceManager...
View ArticleHow Does a ServiceManager Plugin gets Initialized?
Hopefully this post will explain and answer this question.For this example, I will trace the initialization of the FilterManager Plugin.For those who are not familiar with the plugin functionality of...
View ArticleTIP: How to Immitate init() inside Controllers in ZF2
For ZF1 users there is the convenient init() method that you can use on every controller but in ZF2 the init() does not exist anymore for design purposes.There are sometimes advantages though of having...
View ArticleTIP: How to Retrieve and Register Custom Controller Plugins
You can think of controller plugins as action helpers in ZF1.In order to retrieve the list of plugins including custom plugins you created.Create a custom plugin: //module.phpclass Module{ public...
View ArticleRouting URI With Forward Appended Slashes in ZF2
You may sometimes want to route forward appended URIs to its last corresponding action.For example:http://www.sample.com/mycontroller/login/ (WILL NOT route to login...
View ArticleZF2's MVC Event Trigger Sequence
Below is the trigger sequence of Zend Frameworks 2's MVC Event. 1.) MvcEvent::EVENT_BOOTSTRAP returns: Zend\Mvc\Application a.) MvcEvent::EVENT_ROUTE Returns: Zend\Mvc\Application b.)...
View ArticleREPOST: Setting up PHP to connect to a MS SQL Server using PDO_ODBC in Ubuntu
For those who are not familiar of ODBC like I was, its basically an API that lets you connect to other databases. PDO has its ODBC driver which in turn ODBC has its own also. To connect to MS SQL...
View Article