Skip to content

Commit

Permalink
API Add deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 20, 2024
1 parent 6b6fcbc commit 908c59b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Storage/DBFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use SilverStripe\Assets\Thumbnail;
use SilverStripe\Control\Director;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\FieldType\DBComposite;
use SilverStripe\ORM\ValidationException;
use SilverStripe\ORM\ValidationResult;
Expand Down Expand Up @@ -503,15 +504,28 @@ protected function assertFilenameValid($filename)
}
}


/**
* Hook to validate this record against a validation result
*
* @param ValidationResult $result
* @param string $filename Optional filename to validate. If omitted, the current value is validated.
* @return bool Valid flag
* @deprecated 2.4.0 Use validateFilename() instead
*/
public function validate(ValidationResult $result, $filename = null)
{
Deprecation::withSuppressedNotice(function () {
Deprecation::notice('2.4.0', 'Use validateFilename() instead');
});
return $this->validateFilename($result, $filename);
}

/**
* Hook to validate this record against a validation result
*
* @param string $filename Optional filename to validate. If omitted, the current value is validated.
*/
public function validateFilename(ValidationResult $result, $filename = null): bool
{
if (empty($filename)) {
$filename = $this->getFilename();
Expand Down

0 comments on commit 908c59b

Please sign in to comment.