So doing something like the following would be ok?
PHP Code:
<?php
abstract class TableDataGatewayBase
{
protected $_hasOne = array();
/**
* The array has a structure like:
*
* array('authors' => 'author')
*/
protected $_hasMany = array();
protected $_belongsTo = array();
/** CRUD operations **/
public function create($row);
public function read($pk);
public function update($row);
public function delete($pk);
public function hasMany($what)
{
if(!in_array($this->_hasMany, $what))
{
return false;
}
if(!$this->_hasMany[$what] instanceof TableDataGatewayBase)
{
$this->_hasMany[$what] = Finder::findForParent($what, $this->getId()); // probably bad naming, sth like findBelongingTo would be better?
}
return $this->_hasMany[$what];
}
}
?>
Please be forgiving, if I totally missed the point, but practically I'm new to this stuff
And my english isn't really making the whole thing easier
Bookmarks