File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -131,12 +131,13 @@ class FirewallAlias extends Model {
131131 }
132132
133133 /**
134- * Adds custom validation to `detail` field
135- * @param string $detail The incoming value to be validated.
134+ * Adds extra validation to the entire model. This is primarily used to ensure the `detail` field automatically
135+ * creates entries to match the number of `address` entries if there are not enough, or throws an error if there
136+ * are too many.
136137 * @returns string The validated value to be set.
137- * @throws ValidationError When the `detail` value is invalid .
138+ * @throws ValidationError When the `detail` array has too many entries .
138139 */
139- public function validate_detail ( string $ detail ): string {
140+ public function validate_extra ( ): void {
140141 # Throw an error if there are more `detail` items than `address` items
141142 if (count ($ this ->detail ->value ) > count ($ this ->address ->value )) {
142143 throw new ValidationError (
@@ -149,8 +150,6 @@ class FirewallAlias extends Model {
149150 while (count ($ this ->detail ->value ) < count ($ this ->address ->value )) {
150151 $ this ->detail ->value [] = 'Entry added ' . date ('r ' );
151152 }
152-
153- return $ detail ;
154153 }
155154
156155 /**
You can’t perform that action at this time.
0 commit comments