Created
May 28, 2013 05:33
-
-
Save oojacoboo/5660667 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Gets all the tenants associated with this unit that are current on their lease | |
| * @param bool $includeMovedOutWithBalanceDue | |
| * @return array|PropelCollection | |
| */ | |
| function getCurrentTenants($includeMovedOutWithBalanceDue = false) { | |
| //using array filter to pull cached tenant array from object for speed | |
| return array_filter($this->getTenants()->getData(), function($tenant) use ($includeMovedOutWithBalanceDue) { | |
| return ((!$tenant->getMoveOutDate() || $tenant->getMoveOutDate("U") > time()) | |
| || (!$includeMovedOutWithBalanceDue || $tenant->getBalance() < 0) | |
| ); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment