```php
class HomePage extends Page
{
private static $many_many = [
'HeroImages' => [
'through' => PageImageLink::class,
'from' => 'Page',
'to' => 'Image',
]
];
}
```
```php
class PageImageLink extends DataObject
{
private static $has_one = [
'Page' => SiteTree::class,
'Image' => Image::class,
];
}
This fails because the linking object's relation class doesn't exactly match the owner. Sharing the linking objects across various entries in the ancestry should be a supported use case.
Co-authored-by: Aaron Carlino <unclecheese@leftandmain.com>
There are also a few general corrections to PHPDocs that I noticed along
the way (e.g. adding `|null` when the method is returning a null value.
There are some cases where either the return type or the whole PHPDoc
was duplicated from the parent class - in those cases I've simply
removed the duplication.
* Fix clobbering of the upload size validation
When the validation is set here like this, it overrides validation which has already been setup with a simple '*' rule for the size based on PHP.
If you've defined in the sites yml config something like
SilverStripe\Assets\Upload_Validator:
default_max_file_size:
'[image]': '2m'
'*' : '1m'
then it will not be respected.
If you review SilverStripe\Assets\Upload_Validator and check the getAllowedMaxFileSize method, you'll see the sizing will be populated (if it hasn't been done before).
You can see it fail by;
- Setup a new SilverStripe site.
- Set your PHP to allow max post / max upload size of 10mb.
- Add the above config to your sites yml file and flush.
- In the CMS you'll be able to upload a 5MB file, when you shouldn't.
* Test that FileField will use size validation if defined
Couple of tests which prove a fix so the FileField and others will use the default_max_file_size setting
* Fix variable name in last commit
This is what happens when you refactor in the github window.
Fix the variable names. This will get squashed once merged.
* Updates the pr - white space and non deprecated method for byte conversion
Remove extra white space to appease the CS. Use the non deprecated method for memstring2bytes
* White space fixes for the phpcs
White space fixes for the phpcs
* Ensure that "memstring2bytes" can handle if an empty or value with no number is passed in
* DEP Bump assets constraint to ensure that change is also pulled in
---------
Co-authored-by: Guy Sartorelli <guy.sartorelli@silverstripe.com>
* ENH Create Requirements::customScriptWithAttributes
* MNT PHP Lint failures corrected
* ENH Refactored attribute handling to avoid API changes, auto lowercase, strong typing
* FIX Updated default value handling for type in customScriptWithAttributes
* DOC Removed white space
* MNT PHP Lint Failures Corrected
* Update src/View/Requirements_Backend.php
Co-authored-by: Steve Boyd <emteknetnz@gmail.com>
* Update src/View/Requirements_Backend.php
Co-authored-by: Steve Boyd <emteknetnz@gmail.com>
* Update tests/php/View/RequirementsTest.php
Co-authored-by: Steve Boyd <emteknetnz@gmail.com>
* FIX Removed extra closing brace in customScriptWithAttributes
* Update src/View/Requirements_Backend.php
Co-authored-by: Steve Boyd <emteknetnz@gmail.com>
* Update src/View/Requirements.php
Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com>
* MNT Fixed left over content definition and created tests for uniquenessIDs
* MNT Fixed PHP Lint Error
* MNT Fix PHP Lint Error
* FIX Remove attribute when calling customScript with the same uniquenessID
---------
Co-authored-by: Steve Boyd <emteknetnz@gmail.com>
Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com>