Yep – this morning I took and passed my first Zend Certified Engineer qualification. As with all the candidates, we are bound by a Non Disclosure Agreement, but my tip for anyone wanting to take the exam is to practise and revise more. I found the questions much trickier than I thought they were going to be (based off the PHP5 mock tests I had left), but rightfully so. Good times people!
Oh yes, by the way I know the link doesn’t work yet, but I’m informed it can take 24-48 hours for my Zend Yellow Pages entry to become live… It’s live now
Simples:
<?php
// IN THE FORM
$field->addPrefixPath('NS_Validate_', '../library/NS/Validate', 'validate');
$field->setLabel('Enter one')
->setRequired(true)
->addValidator('ValueEqualsOne');
// In library/NS/Validate/ValueEqualsOne.php
class NS_Validate_ValueEqualsOne extends Zend_Validate_Abstract
{
const DOESEQUALONE = 'doesequalone';
protected $_messageTemplates = array(
self::DOESEQUALONE => "This value does not equal one",
);
public function isValid($value)
{
$this->_setValue($value);
if($value == 1)
return true;
$this->_error();
return false;
}
}
I’m not sure yet how to get around having to do the addPrefixPath call every time, but I’ll have to do some hacking I guess…
I have a nasty habit of not adding base URLs to my projects because I never think about anyone else who might use it. Anyway, you can get the base URL like this:
In a Controller
$this->getFrontController()->getBaseUrl()
In a View script
Reminder really, nothing more. It would be nice to know if there was a less long winded way of getting the base URL everywhere though…
So tonight I released the start of some useful PHP libraries I use when I’m doing Zend Framework coding. Right now there’s hardly anything there (an eBay Trading API client, and a DbTable Mapper tool) but I’m planning on adding more stuff as I find it useful. It’s released under the GNU GPLv3, although to be frank I have no idea what is good and what’s not…
What’s quite special for me is that this is the first time I’ve actually released my own source code under an open source license. I’ve done plenty of development in my time, but for such a long time I’ve wanted to give back to the community. I know it’s not a huge amount at the moment, but it’s a start and I hope to build on it, and hopefully someone, somewhere, will find it useful and perhaps even contribute back one day.
I’ve called my libraries “MAL” which (hat-tip to @robertbasic here!) stands for Mighty Asgrim’s Libraries… which will do just fine I guess. I didn’t come up with anything better, and “MAL” is quite catch anyway.
Anyway, if you’d like to check it out, take a peek on github at: https://github.com/Asgrim/MAL
Eclipse PDT and Zend Studio are really nice editors for general use. Once they’re set up the way you want, they work mostly fine. I have an issue where I type a dollar symbol ($) and the code assist goes off in a wobbly, probably due to the size of the projects we work on at Netbasic, and the fact that we’re all working off a network drive (ridiculous in my opinion…).
The biggest gripe I have with Eclipse however, is trying to install plug-ins. I don’t think I’ve EVER installed a plug-in without having to manually mess around with dependencies and trying to manually resolve them. It’s a HUGE downfall, and makes any Eclipse IDE virtually unusable. It’s intensely annoying when I just want to get on with things, but some bloody plug-in I need (normally the CollabNet/Mylyn plugins) just won’t install without getting in a hissy fit.
Take for example this latest error:
Cannot complete the install because of a conflicting dependency.
Software being installed: Mylyn Task List (Required) 3.2.0.v20090617-0100-e3x (org.eclipse.mylyn_feature.feature.group 3.2.0.v20090617-0100-e3x)
Software currently installed: Zend Studio 7.0.0.v20090806 (com.zend.php.ide 7.0.0.v20090806)
Only one of the following can be installed at once:
Java 5 Compatibility Checker 3.2.0.v20090617-0100-e3x (org.eclipse.mylyn.compatibility 3.2.0.v20090617-0100-e3x)
Java 5 Compatibility Checker 3.2.1.v20090722-0200-e3x (org.eclipse.mylyn.compatibility 3.2.1.v20090722-0200-e3x)
Cannot satisfy dependency:
From: Zend Studio 7.0.0.v20090806 (com.zend.php.ide 7.0.0.v20090806)
To: org.eclipse.mylyn.ide_feature.feature.group [3.2.1.v20090722-0200-e3x]
Cannot satisfy dependency:
From: Mylyn Task-Focused Interface (Recommended) 3.2.1.v20090722-0200-e3x (org.eclipse.mylyn.context_feature.feature.group 3.2.1.v20090722-0200-e3x)
To: org.eclipse.mylyn_feature.feature.group [3.2.1.v20090722-0200-e3x]
Cannot satisfy dependency:
From: Mylyn Bridge: Eclipse IDE 3.2.1.v20090722-0200-e3x (org.eclipse.mylyn.ide_feature.feature.group 3.2.1.v20090722-0200-e3x)
To: org.eclipse.mylyn.team_feature.feature.group [3.2.1.v20090722-0200-e3x]
Cannot satisfy dependency:
From: Mylyn Bridge: Team Support 3.2.1.v20090722-0200-e3x (org.eclipse.mylyn.team_feature.feature.group 3.2.1.v20090722-0200-e3x)
To: org.eclipse.mylyn.context_feature.feature.group [3.2.1.v20090722-0200-e3x]
Cannot satisfy dependency:
From: Mylyn Task List (Required) 3.2.0.v20090617-0100-e3x (org.eclipse.mylyn_feature.feature.group 3.2.0.v20090617-0100-e3x)
To: org.eclipse.mylyn.compatibility [3.2.0.v20090617-0100-e3x]
Cannot satisfy dependency:
From: Mylyn Task List (Required) 3.2.1.v20090722-0200-e3x (org.eclipse.mylyn_feature.feature.group 3.2.1.v20090722-0200-e3x)
To: org.eclipse.mylyn.compatibility [3.2.1.v20090722-0200-e3x]
From what I understand here, I can’t install Mylyn because of a 0.0.1 version difference. Because of two packages that were released within a month of each other?! That – in my opinion – is stupid. I just want to get on with things but I can’t because of this.
I sincerely hope the next version of Eclipse will sort out this stupid dependency issue, as if I was the Eclipse development team, this sort of difficulty-of-use issue would be a real show-stopper. In addition, I have no idea why Zend would base their €399 IDE which is meant to be a “professional-grade” solution to “maximise developer productivity” on such a shoddy, buggy IDE.