定制 fromholdio/silverstripe-commonancestor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.17k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-02-18