Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX many_many through should allow subclasses #11230

Commits on May 10, 2024

  1. FIX many_many through should allow subclasses

    ```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.
    Aaron Carlino authored and GuySartorelli committed May 10, 2024
    Configuration menu
    Copy the full SHA
    fcfbb75 View commit details
    Browse the repository at this point in the history