Created
February 15, 2013 13:40
-
-
Save mbernson/4960430 to your computer and use it in GitHub Desktop.
Idea for Activerecord callbacks in PHP.
This file contains 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
<?php | |
class Event extends ActiveRecord\Model | |
{ | |
static private $before_save = 'calculate_seats_available'; | |
private function calculate_seats_available() { | |
$this->seats_available = $this->seats - $this->seats_taken; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment