<?php
function orm_for($type) {
}
function peer_for($type) {
}
function exception_for($type) {
}
function query($type, $data) {
$peer = $peer_for($type);
$exception = $exception_for($type);
$obj = null;
$criteria = new Criteria();
$criteria->add($peer::CONTRACTNR, $data["contractnr"]);
$result = $peer::doSelect($criteria);
throw new $exception("status: more than one row with the specified contractnr.");
} else if(count($result) == 0) { $obj = $this->factory->createORM(orm_for($type));
$obj->setCreatedAt(time()); } else {
$obj = $result[0];
}
}
class FoobarPeer {
static function print_self() {
echo 'FoobarPeer::print_self()';
}
};
class FoobarException extends Exception {
};
$foobar = "foobar";
$foobar_peer = peer_for($foobar);
$foobar_exception = exception_for($foobar);
echo "Peer for ".$foobar." : ".$foobar_peer."\n";
echo "Exception for ".$foobar." : ".$foobar_exception."\n";
$foobar_peer::print_self();
throw new $foobar_exception("blah");
?>