src/RecursivePublishable.php
protected function lookupReverseOwners()
    {
        // Find all classes with 'owns' config
        $lookup = [];
        $classes = ClassInfo::subclassesFor(DataObject::class);
        array_shift($classes); // skip DataObject
        foreach ($classes as $class) {
            // Ensure this class is RecursivePublishable
            if (!DataObject::has_extension($class, static::class)) {
                continue;
            }

            // Check owned objects for this class
            $owns = Config::inst()->get($class, 'owns', Config::UNINHERITED);
            if (empty($owns)) {
                continue;
            }

            $instance = DataObject::singleton($class);
            foreach ($owns as $owned) {
                // Find owned class
                $ownedClass = $instance->getRelationClass($owned);
                // Skip custom methods that don't have db relations, or cannot be inferred
                if (!$ownedClass || $ownedClass === DataObject::class) {
                    continue;
                }

                // Add lookup for owned class
                if (!isset($lookup[$ownedClass])) {
                    $lookup[$ownedClass] = [];
                }
                $lookup[$ownedClass][] = [
                    'class' => $class,
                    'relation' => $owned
                ];
            }
        }
        return $lookup;
    }
protected function lookupReverseOwners()
    {
        // Find all classes with 'owns' config
        $lookup = [];
        $classes = ClassInfo::subclassesFor(DataObject::class);
        array_shift($classes); // skip DataObject
        foreach ($classes as $class) {
            // Ensure this class is RecursivePublishable
            if (!DataObject::has_extension($class, static::class)) {
                continue;
            }

            // Check owned objects for this class
            $owns = Config::inst()->get($class, 'owns', Config::UNINHERITED);
            if (empty($owns)) {
                continue;
            }

            $instance = DataObject::singleton($class);
            foreach ($owns as $owned) {
                // Find owned class
                $ownedClass = $instance->getRelationClass($owned);
                // Skip custom methods that don't have db relations, or cannot be inferred
                if (!$ownedClass || $ownedClass === DataObject::class) {
                    continue;
                }

                // Add lookup for owned class
                if (!isset($lookup[$ownedClass])) {
                    $lookup[$ownedClass] = [];
                }
                $lookup[$ownedClass][] = [
                    'class' => $class,
                    'relation' => $owned
                ];
            }
        }
        return $lookup;
    }
protected function lookupReverseOwners ( ) { // Find all classes with 'owns' config $ lookup = [ ] ; $ classes = ClassInfo :: subclassesFor ( DataObject :: class ) ; array_shift ( $ classes ) ; // skip DataObject foreach ( $ classes as $ class ) { // Ensure this class is RecursivePublishable if ( ! DataObject :: has_extension ( $ class , static :: class ) ) { continue ; } // Check owned objects for this class $ owns = Config :: inst ( ) -> get ( $ class , 'owns' , Config :: UNINHERITED ) ; if ( empty ( $ owns ) ) { continue ; } $ instance = DataObject :: singleton ( $ class ) ; foreach ( $ owns as $ owned ) { // Find owned class $ ownedClass = $ instance -> getRelationClass ( $ owned ) ; // Skip custom methods that don't have db relations, or cannot be inferred if ( ! $ ownedClass || $ ownedClass === DataObject :: class ) { continue ; } // Add lookup for owned class if ( ! isset ( $ lookup [ $ ownedClass ] ) ) { $ lookup [ $ ownedClass ] = [ ] ; } $ lookup [ $ ownedClass ] [ ] = [ 'class' => $ class , 'relation' => $ owned ] ; } } return $ lookup ; }
Find a list of classes, each of which with a list of methods to invoke
to lookup owners.

@return array
Find a list of classes each of which with a list of methods to invoke to lookup owners .