public function create($overrides = array(), $associated = array())
{
$built = $this->build($overrides, $associated);
// process any many-to-many associations
$many_to_many = array();
foreach ($associated as $name => $row) {
$association = $this->_associations[$name];
if ($association instanceof Association\ManyToMany) {
if (!is_array($row)) {
$row = array($row);
}
$many_to_many[$name] = array($row, $association);
}
}
$built->save();
if ($many_to_many) {
$this->_associateManyToMany($built, $many_to_many);
}
return $built;
}