
Right clicking to create new table classes in Zend Studio for Eclipse can get very annoying. The best solution is to create shortcut for it. To do this:
- open up preferences (cmd + , if you're on a mac).
- type in "keys" without the quotation marks.
- to the right enter "Zend Table" into the "type filter text" field.
- You'll see the "New (New Wizard: Zend Table)" command.
- Click on it
- Click on the binding text box and press your command keys.
Hope that speeds things up a little!
Miscellaneous
I'd run into a problem in the Zend Table where when inserting data from a form, if a field didn't exist in the database ZF would crap out with an exception. Having to unset posted variables I didn't need, meant more typing, more typing meant more unnecessary code.
I found the easiest way to get around this is by overriding the insert method in my extended App_Db_Table_Abstract class. Here's what my new insert method looks like.
public function insert($data, $skip = true){
if($skip === true){
$oldData = $data;
foreach($this->info('metadata') as $key => $value){
if(isset($oldData[$key])){ $data[$key] = $oldData[$key];
}
}
}
parent::insert($data);
}
The method takes two parameters, the data ($data) and a Boolean value ($skip). Skip defaults to true, so I don't need to add this parameter to every call to insert, it's also there in case I don't want to skip my data.
It then iterates through the table meta data, which contains the field names for the table, checks to see if the key exists in the data from the form. If the field exists in the array then it's added to the new data array.
Finally the parent insert method is called, bobs your uncle.
In case you're wondering, I've subclassed some of the Zend classes, this allows me to override methods to my liking.
PHP, Zend Framework Zend Framework, Zend_Db_Table_Abstract

No, not me, just my old blog, trying to maintain just one blog is tedious enough, but with the new fishrod site and it's amazing blog, this and gavinwilliams.co.uk managing them is going to be a task and a half.
As of now gavinwilliams.co.uk now redirects to justanotherdeveloper.co.uk whilst the fishrod blog will aggregate data from both my blog and Siobhan Bentley's (hopefully she'll something decent to say every now and then).
Miscellaneous
Over at fishrod we're developing our new CMS based on the new Zend Framework 1.7 (biting our nails for 2.0 to be released so we can relax for at least 3 months). One of the issues that always arises when developing a Content Management System for our clients is the amount of flexibility we want to offer them, and how generic the CMS has to be whilst still being flexible.
Read more...
PHP cms, meta data, Zend Framework

Google seems to have gotten a nice new social facelift, allowing users to rate/rank their personal search results (much like digg) and to provide comments on them, pretty interesting! I wonder how many terabytes of data and bandwidth that's gonna cost em!
Miscellaneous google, interactive media, search, social
A decision by a number of UK internet providers to block a Wikipedia page showing an image of a naked girl has angered users of the popular site.
BBC NEWS | UK | Wikipedia child image censored
This just hit my RSS reader in flock. It's quite interesting to know that ISP's are actually blocking websites based on complaints from other people, are we going to see online mediators in the near future? I hope not! The internet's the one place where we can freely share ideas and collaborate without mediation, we don't need a virtual nanny state, we're already being told what we can and can't do in the real world!
Theory censorship, interactive media production, Media
Working at Channel 4 I've been introduced to Agile Development, to sum it up in one sentence...
"It's a way of working in a development team, where the specification for a project is constantly changing and the waterfall approach (you get a spec, build to it over a long period of time, get feedback and make amends) just doesn't cut it."
It's a completelty different way of working, and it's full of terms which I would say were thought up by some drunk developer, introducing words such as "brown bag".
Read more...
Development Strategies, Javascript, PHP agile, Development Strategies, PHP
I've spent the last few hours trying to extend Zend_Acl_Role_Registry and Zend_Acl to support Db storage, when it just hit me what I'm actually trying to do, and a much easier way to do it!
Read more...
PHP, Zend Framework acl, aro, Zend Framework
With JavaScript being taken alot more seriously, we're seeing a rise in JS best practices, the days when JavaScript would be mocked based upon annoying popup's, really crap navigation systems that broke in every browser except IE, and seriously disgusting page effects that should stay relegated on people's myspace pages are pretty much over. JavaScript has reached a new standard and coders are helping to drive it.
Read more...
Javascript Javascript, tools
A few weeks ago I was introduced to the Publisher Subscriber pattern in JS, pretty much confused by the methodology behind it I decided to give it a go.
The publisher subscriber pattern allows several methods to subscribe to a particular event. Methods and functions can unsubscribe and subscribe to any event at will, this is handy if you want to remove or add a method to an event handler at runtime.
Read more...
Design Patterns, Javascript Design Patterns, patterns, publisher subscriber
Recent Comments