Skip to content

Commit

Permalink
マーキング漏れを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Oct 10, 2023
1 parent e3e2cd2 commit e3a3c0c
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 115 deletions.
23 changes: 14 additions & 9 deletions plugins/bc-custom-content/src/Model/Table/CustomFieldsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public function initialize(array $config): void
*
* @param Validator $validator
* @return Validator
* @checked
* @noTodo
*/
public function validationDefault(Validator $validator): Validator
{
Expand Down Expand Up @@ -79,7 +81,7 @@ public function validationDefault(Validator $validator): Validator
'rule' => ['checkSelectList'],
'message' => __d('baser_core', '選択リストに同じ項目を複数登録できません。')
]
]);
]);
return $validator;
}

Expand All @@ -89,19 +91,20 @@ public function validationDefault(Validator $validator): Validator
* @param EventInterface $event
* @param ArrayObject $content
* @param ArrayObject $options
* @checked
* @noTodo
*/
public function beforeMarshal(EventInterface $event, ArrayObject $content, ArrayObject $options)
{
// beforeMarshal のタイミングで変換しないと配列が null になってしまう
if(!empty($content['meta'])) {
if (!empty($content['meta'])) {
$content['meta'] = json_encode($content['meta'], JSON_UNESCAPED_UNICODE);
}
if(!empty($content['validate'])) {
if (!empty($content['validate'])) {
$content['validate'] = json_encode($content['validate'], JSON_UNESCAPED_UNICODE);
}
}


/**
* Find all
*
Expand All @@ -110,14 +113,16 @@ public function beforeMarshal(EventInterface $event, ArrayObject $content, Array
* @param Query $query
* @param array $options
* @return Query
* @checked
* @noTodo
*/
public function findAll(Query $query, array $options = []): Query
{
return $query->formatResults(function (\Cake\Collection\CollectionInterface $results) {
return $results->map(function ($row) {
if(!$row) return $row;
if(isset($row->meta) && $row->meta) $row->meta = json_decode($row->meta, true);
if(isset($row->validate) && $row->validate) $row->validate = json_decode($row->validate, true);
return $query->formatResults(function(\Cake\Collection\CollectionInterface $results) {
return $results->map(function($row) {
if (!$row) return $row;
if (isset($row->meta) && $row->meta) $row->meta = json_decode($row->meta, true);
if (isset($row->validate) && $row->validate) $row->validate = json_decode($row->validate, true);
return $row;
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use BaserCore\Annotation\UnitTest;
use BaserCore\Annotation\NoTodo;
use BaserCore\Annotation\Checked;
use BcCustomContent\Model\Entity\CustomField;
use Cake\Core\Configure;
use Cake\Datasource\EntityInterface;
use Cake\Event\EventInterface;
Expand Down Expand Up @@ -128,6 +127,8 @@ public function setTreeScope(int $tableId): void
* @param EntityInterface $entity
* @param ArrayObject $options
* @return bool|void
* @checked
* @noTodo
*/
public function beforeSave(EventInterface $event, EntityInterface $entity, ArrayObject $options)
{
Expand All @@ -143,6 +144,8 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array
* @param EventInterface $event
* @param EntityInterface $entity
* @param ArrayObject $options
* @checked
* @noTodo
*/
public function beforeDelete(EventInterface $event, EntityInterface $entity, ArrayObject $options)
{
Expand All @@ -154,6 +157,8 @@ public function beforeDelete(EventInterface $event, EntityInterface $entity, Arr
* 並び順を更新する
*
* @param array $customLinks
* @checked
* @noTodo
*/
public function updateSort(array $customLinks)
{
Expand Down Expand Up @@ -232,6 +237,8 @@ public function moveOffset($field, $offset)
* @param string $name
* @param int $tableId
* @return string
* @checked
* @noTodo
*/
public function getUniqueName(string $name, int $tableId)
{
Expand Down
44 changes: 18 additions & 26 deletions plugins/bc-custom-content/src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ class Plugin extends BcPlugin
* @param array $options
* - `plugin` : プラグイン名
* - `connection` : コネクション名
* @checked
* @noTodo
*/
public function install($options = []) : bool
public function install($options = []): bool
{
// ここに必要なインストール処理を記述
$result = parent::install($options);
Expand All @@ -49,18 +51,6 @@ public function install($options = []) : bool
return $result;
}

/**
* プラグインをアンインストールする
* - `plugin` : プラグイン名
* - `connection` : コネクション名
* - `target` : ロールバック対象バージョン
*/
public function uninstall($options = []): bool
{
// ここに必要なアンインストール処理を記述
return parent::uninstall();
}

/**
* services
* @param ContainerInterface $container
Expand All @@ -76,6 +66,8 @@ public function services(ContainerInterface $container): void
* Bootstrap
*
* @param PluginApplicationInterface $app
* @checked
* @noTodo
*/
public function bootstrap(PluginApplicationInterface $app): void
{
Expand All @@ -97,25 +89,25 @@ public function loadPlugin(): void
[$path]
));

$Folder = new Folder($path);
$files = $Folder->read(true, true, false);
if(empty($files[0])) return;
$Folder = new Folder($path);
$files = $Folder->read(true, true, false);
if (empty($files[0])) return;

if(Configure::read('BcRequest.asset')) {
// TODO ucmitz 検証要
foreach($files[0] as $pluginName) {
BcUtil::includePluginClass($pluginName);
}
} else {
foreach($files[0] as $pluginName) {
if (Configure::read('BcRequest.asset')) {
// TODO ucmitz 検証要
foreach($files[0] as $pluginName) {
BcUtil::includePluginClass($pluginName);
}
} else {
foreach($files[0] as $pluginName) {
// 設定ファイルを読み込む
if(!BcUtil::includePluginClass($pluginName)) continue;
if (!BcUtil::includePluginClass($pluginName)) continue;
$pluginCollection = CakePlugin::getCollection();
$plugin = $pluginCollection->create($pluginName);
$pluginCollection->add($plugin);
BcEvent::registerPluginEvent($pluginName);
}
}
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class CustomEntriesService implements CustomEntriesServiceInterface

/**
* Constructor
* @checked
* @noTodo
*/
public function __construct()
{
Expand All @@ -68,6 +70,8 @@ public function __construct()
*
* @param int $tableId
* @return EntityInterface
* @checked
* @noTodo
*/
public function getNew(int $tableId)
{
Expand Down
4 changes: 3 additions & 1 deletion plugins/bc-custom-content/src/Utility/CustomContentUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ class CustomContentUtil
* @param $plugin
* @param string $name
* @return mixed
* @checked
* @noTodo
*/
public static function getPluginSetting(string $plugin, string $name = '')
{
if($name) {
if ($name) {
return Configure::read("BcCustomContent.fieldTypes.$plugin.$name");
} else {
return Configure::read("BcCustomContent.fieldTypes.$plugin");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

use BaserCore\View\Helper\BcPluginBaserHelperInterface;
use Cake\View\Helper;
use BaserCore\Annotation\UnitTest;
use BaserCore\Annotation\NoTodo;
use BaserCore\Annotation\Checked;

/**
* MailBaserHelper
Expand All @@ -34,6 +37,8 @@ class BcCustomContentBaserHelper extends Helper implements BcPluginBaserHelperIn
* メソッド一覧取得
*
* @return array[]
* @checked
* @noTodo
*/
public function methods(): array
{
Expand Down
Loading

0 comments on commit e3a3c0c

Please sign in to comment.