fix: [lax URL validation] added for Broodstable
- can be reused elsewhere too - allows for http://hostname style urlscli-modification-summary
parent
f695744bd7
commit
519fcd2b1a
|
@ -46,4 +46,9 @@ class AppTable extends Table
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function isValidUrl($value, array $context): bool
|
||||
{
|
||||
return filter_var($value, FILTER_VALIDATE_URL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,11 @@ class BroodsTable extends AppTable
|
|||
->requirePresence(['name', 'url', 'organisation_id'], 'create')
|
||||
->notEmptyString('name')
|
||||
->notEmptyString('url')
|
||||
->url('url', __('The provided value is not a valid URL'))
|
||||
->add('url', 'isValidUrl', [
|
||||
'rule' => 'isValidUrl',
|
||||
'message' => __('The provided value is not a valid URL'),
|
||||
'provider' => 'table'
|
||||
])
|
||||
->naturalNumber('organisation_id', false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue