The Zend Framework naming standards require that all classes be
named based upon the directory structure in which they are located.
For instance, extensions related to Spreadsheets are stored in:
Zend/Gdata/Spreadsheets/Extension/... and, as a result
of this, are named
This causes a lot of typing if you're trying to construct a new
instance of a spreadsheet cell element!
We've implemented a magic factory method in all service classes
Zend_Gdata_Spreadsheets) that should make constructing new
instances of data model, query and other classes much easier. This magic factory is
implemented by using the magic
__call() method to intercept all
attempts to call $service->newXXX(arg1, arg2, ...). Based off
the value of XXX, a search is performed in all registered 'packages'
for the desired class. Here's some examples:
$ss = new Zend_Gdata_Spreadsheets();
// creates a Zend_Gdata_App_Spreadsheets_CellEntry
$entry = $ss->newCellEntry();
// creates a Zend_Gdata_App_Spreadsheets_Extension_Cell
$cell = $ss->newCell();
$cell->setText('My cell value');
$entry->cell = $cell;
// ... $entry can then be used to send an update to a Google Spreadsheet
Each service class in the inheritance tree is responsible for registering the appropriate 'packages' (directories) which are to be searched when calling the magic factory method.