Archive: zend framework

 

If you encounter the error :
Invalid bind-variable name xxxxxx
When trying to use named bound parameters with Zend Framework, then you are probably using the Mysqli adapter. Unfortunately this doesn't actually support named parameters, but the Exception message isn't really clear on that, despite being thrown in this block of code:
PLAIN TEXT
PHP:

} else if ($val[0] [...]



 

If you use Zend_Db_Statements directly as well as using the Zend_Db_Table family of classes for Active Record et al then you might find the following little tip useful.
By default, if you run a query using something like
PLAIN TEXT
PHP:

public function query($sql, $params=false) {

    if(empty($params)) {

        $stmt = $this->getAdapter()->query($sql);

    }else {

    [...]



 

Currently working on a big Zend Framework project so I though I would have a breather and do a little blog post targeted at anyone looking for a UK based Zend Framework developer.
I've built a few Zend Framework based systems and have found it a fun system to work with, especially on the more recent [...]



 

With some trepidation I decided that I really had to implement pagination into a Zend Framework project I am working on. Zend Framework is great, but some of the sections can be a little tricky to get your head around at first attempt.
However, less than an hour after first looking at it, I have now [...]



 

If you develop using Zend Framework you will know that it is sometimes tricky to see exactly whats going on in terms of SQL queries. After trying a few different ideas including subclassing the database classes or other complex systems, the easiest I have found is this:
1. Edit your app.ini config file and add a [...]



 

After losing an afternoon trying to get my extended Zend Dojo Form class to give me HTML array notation, I have finally found a solution that works. To celebrate I've decided to share it should anyone else suffer a similar problem.
Here is the method:
PLAIN TEXT
PHP:

public function addSubFormEl($subFormName, $addElOptions){

        call_user_func_array(array($this,'addElement'), $addElOptions);

      [...]



 

Problem:
You are dutifully setting your size attribute in your Zend Form class and you input elements are being rendered with that size attribute. However if Javascript is enabled and you are using Dojo for your forms, the size attribute gets dropped.
Solution:
To set the width on dojo form elements you must use the width css [...]



 

If like me you kicked off your Zend Framework experience with the Quick Start and have kept the error controller system of the Quick Start for your other ZF projects, you might find this little snippet useful.
The Quick Start uses the Exception::getTraceAsString() method to give you the stack trace. Unfortunately this function seems to [...]



 

I have recently been messing around trying to figure out the best way of running long processes within a Zend Framework App.
Usually I would code in regular flush(); commands to make sure that the browser didnt time out and also that the user can see that something is happening.
However, the standard MVC structure of [...]



 

I use this little function as part of my base form class to enable me to easily lock certain form elements.
PLAIN TEXT
PHP:

public function lockField($field){       

        $elem = $this->getElement($field);       

        $elem->setAttrib('disabled', true);

        $elem->setAttrib('readonly',true);

    }

usage might be like the following:
PLAIN [...]