27th April 2006
(Putting this here, mainly so that I can reference it!)
There's a bug in Zend_Db_Adapter_Pdo_Abstract::insert(). I posted in to the mailing list and it's available here in the archives.
In short, if you use the PDO drivers and have table field names with underscores in them, then you need to delete the insert() function within the class Zend_Db_Adapter_Pdo_Abstract.
Read the rest of this entry »
Posted in PHP, Zend Framework | No Comments »
25th April 2006
Matthew Delmarter noticed a problem with Akrabat_Config. Essentially when you load a single section that overrides one item of a nested array from another section, all the other items get "lost".
I've fixed it and this time thought I'd supply a zip file of the files!
Akrabat_Config-0.5.zip
Akrabat_Config_Tests-0.5.zip
I've also updated the code so that it can support different types of config files. We now have Akrabat_Config_Abstract and Akrabat_Config_Ini.
A test for the bug is as follows: Read the rest of this entry »
Posted in PHP, Zend Framework | 1 Comment »
18th April 2006
I posted a Zend Framework proposal for Zend_Config, obviously based on the work I've done so far for Akrabat_Config.
The main difference from the Akrabat_Config posted here is that I've split the class into Zend_Config_Abstract and Zend_Config_Ini so that it can easily be extended to support YAML or XML or whatever other config file formats there are.
The proposal is: Read the rest of this entry »
Posted in PHP, Zend Framework | 2 Comments »
10th April 2006
Ok, I'm dense!
I've finally worked out what Nico was saying in that Akrabat_Config doesn't allow for more than one included section when using the "include=" construct. This is because parse_ini_file() will overwrite keys of the same name.
Thus to support multiple sections the syntax has to be:
include = one,two,three
Akrabat_Config now looks like this:
Read the rest of this entry »
Posted in PHP, Zend Framework | 7 Comments »
10th April 2006
Update: I've made the filename parameter in the constructor optional as per Nico's comment on the mailing list. I've also updated the code so that it meets the coding style
There's been some more discussion about config on fw-general. Thanks all!
I commented that I think the ability to load multiple ini files would be useful and suggested using an array of filename.
Nico suggested:
You could just put the code from the constructor in its own method load(). Then it would be possible to write:
$config = new Akrabat_Config();
$config->load('mainconfig.ini');
$config->load(IS_DEV ? 'dev.ini' : 'staging.ini');
That's much nicer, so that's they way I've gone. I've also kept the "first dot" separation and the "include=" constructs so this new version passes all the original tests and allows for a lot of flexibility. Even nicer, each bit is optional so you can pick and choose what you use.
This is the class:
Read the rest of this entry »
Posted in PHP, Zend Framework | 2 Comments »
8th April 2006
Update! This version has been superceded! Check out Akrabat_Config (Take Three!) for an even better version…
Nico Edtinger was kind enough to review Akrabat_Config and pointed out that it wouldn't handle a key with multiple dots in it. His post to fw-general:
One method I don't "like" is processSection(). If I have a name like "foo.bar.baz" it would be saved as $config['foo']['bar'], dropping the last part because you explode without a third parameter. It should be
$pieces = explode('.', $key, 2);
I'd also change the check for a dot to
if(strpos($key, '.')) {
That would work with a key with a leading dot (being stored just as is instead of $config[''][...]) and the explode doesn't need to parse a string that doesn't have a dot anyway and create an array that's not needed.
Thus, this is my second attempt at Akrabat_Config:
Read the rest of this entry »
Posted in PHP, Zend Framework | 2 Comments »
7th April 2006
Update! This version has bugs! Check out Akrabat_Config (2nd Attempt) for a better version.
Work has been manic, but I've finally found some time to do a bit more work on my Zend Framework test site. I've now got a concept for a simple CRUD type application that I'd like to write. It's hardly imaginative and I'm sure that there are loads of other ones out there already, but it'll do for testing stuff :)
My initial tests have used config variables directly in index.php, but I've decided that I'm going to need more flexibility than that, so I've written Akrabat_Config as a very simple inifile reader.
The idea is based on an email to the fw-general list from Andi Gutmans. I can't find it in the archive, so I'll quote the relevant bit:
Read the rest of this entry »
Posted in PHP, Zend Framework | No Comments »