fromholdio/silverstripe-commonancestor
最新稳定版本:1.2.0
Composer 安装命令:
composer require fromholdio/silverstripe-commonancestor
包简介
A small utility class that accepts an array of class name, compares their class ancestories, and identifies their closest common ancestor class.
README 文档
README
A small utility class that accepts an array of class name, compares their class ancestories, and identifies their closest common ancestor class.
Class is pretty well commented, jumping into it should answer any initial questions.
Requirements
SilverStripe 4, 5, 6
Installation
composer require fromholdio/silverstripe-commonancestor
(Contrived) Example
Assuming a page class hierarchy of:
- SiteTree
- Page
- BlogHolder
- BlogPost
- ArticlePost
- VideoPost
$exampleOne = [VideoPost::class, ArticlePost::class]; $resultOne = CommonAncestor::get_closest($exampleOne); // returns 'BlogPost' $exampleTwo = [VideoPost::class, BlogPost::class]; $resultTwo = CommonAncestor::get_closest($exampleTwo); // returns 'BlogPost' $exampleThree = [VideoPost::class, BlogHolder::class]; $resultThree = CommonAncestor::get_closest($exampleThree); // returns 'Page'
The get_closest function also accepts a second argument, which allows you to include/exclude classes that have tables ($tablesOnly; set to false by default).
统计信息
- 总下载量: 1.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-02-18