Skip to content

Instantly share code, notes, and snippets.

@andho
Created January 11, 2012 07:38
Show Gist options
  • Save andho/1593580 to your computer and use it in GitHub Desktop.
Save andho/1593580 to your computer and use it in GitHub Desktop.
Normal Doctrinized Invoice
<?php
class Invoice {
private $_items;
private $_totalAmount = 0;
private $_sentDate;
public function isSent() {
return !is_null($this->_sentDate);
}
public function removeItem() {
if ($this->isSent()) {
throw new Exception('Items cannot be changed after invoice is sent');
}
$this->_totalAmount -= $this->_items[$index];
unset($this->_items[$index]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment