Skip to content

Commit

Permalink
Further try to remedy proper registration of directly-extended Attrib…
Browse files Browse the repository at this point in the history
…ute classes into cache
  • Loading branch information
dizzystuff committed Aug 9, 2022
1 parent 730b018 commit d79db62
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Model/Attribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use SilverStripe\Control\Middleware\FlushMiddleware;
use Fromholdio\CommonAncestor\CommonAncestor;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Flushable;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DataObject;
Expand Down Expand Up @@ -214,7 +215,9 @@ private static function build_cache() {
$attributes = [];
$classes = ClassInfo::subclassesFor(DataObject::class);
foreach ($classes as $class) {
if ($class::has_extension(Attribute::class, true)) {
$extensions = $class::config()->get('extensions', Config::UNINHERITED);
$extensions = array_filter(array_values($extensions ?? []));
if (in_array(Attribute::class, $extensions)) {
self::validate_attribute($class);
$attributes[$class] = $class;
}
Expand Down

0 comments on commit d79db62

Please sign in to comment.