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