public function __construct($name, $defaults, $associations = array(), Phactory $phactory = null)
{
if (!$phactory instanceof Phactory) {
throw new \Exception('$phactory must be an instance of Phactory\\Sql\\Phactory');
}
$this->_table = new Table($name, true, $phactory);
$this->_defaults = $defaults;
$this->_sequence = new Sequence();
$this->_phactory = $phactory;
foreach ($associations as $name => $association) {
$association->setFromTable($this->_table);
$this->addAssociation($name, $association);
}
if (!is_array($associations)) {
throw new \Exception("\$associations must be an array of Association objects");
}
}