status = self::STATUS_INACTIVE; $this->create_time = time(); } public function beforeUpdate() { $this->update_time = time(); } public static function generateStreamName($id) { return sprintf('chapter-%03d', $id); } public static function parseFromStreamName($streamName) { return (int)str_replace('chapter-', '', $streamName); } }