A set of classes to wrap around Zend v1. It' goal is to make common patterns easier to implement and to transparently add commonly used functionalities.
DZend is a set of classes to wrap around
Zend. It' goal is to make common
patterns easier to implement and to transparently add commonly used
If a Zend class is wrapped at DZend, then it's name will be the same as the Zend
class but with a D at the beginning, but there is no abstract tables at DZend.
PHP 5.4 >=
The bootstrap instantiate a few commonly used tools.
Zend_Log and write it on registry. To access this instance just
All the logs will be written on the file
Zend_Translate instance is already included on the registry
Similarly to the logger, to access the translate object, call:
The detection of the locale is made automatically, in case none is found,
en_US is the default.
DZend_Db_Table implements the
__call magic function to add a few
functionalities to select queries. For instance, let
DZend_Db_Table and represents the
user database table. To find all female
users, just use the call
$userDb is an
DbTable_User. DZend parses the function name recognize the
The "And" can be used to separate column names. The method of format
findByColumnAAndColumnBAndColumnC($a, $b, $c) will return a
containing all rows that have
column_a = $a AND column_b = $b AND column_c = $c.
To fetch just a
Zend_Db_Table_Row instead of a rowset, use
findBy, there is also
deleteBy, which deletes all matching rows.
If the class extending
$_allowRequestCache to true, then
rows will be cached by ID, when using the methods
Beware that the cache lasts only during the request. Also, be mindful that
changed objects are not updated on cache. If an object is fetched and then updated.
Feching the object a second time will bring the old object.
Zend_Db_Table provides a method
insert that inserts a single row,
DZend_Db_Table provides the
insertMulti method that gets an array of data
arrays, to insert multiple rows.
Usually SQL names for databases, tables and columns uses underscore notation
while programming uses camel notation.
converts between one another. Let
$row be an instance of
$row->columnName can be used to access the column value for
The pre-requisite to get this trait working properly is to have the auth to
store the currently logged in user row on
DZend_Session_Namespace::get('session')->user. It assumes that the
attribute holds the primary key for the user.
DZend_CurrentUser is a trait that provider two methods,
_getUserId(). In case there is not user logged, in it returns
DZend_Db_Table already extends this trait.