Constants

FIELD_DELIMITER

FIELD_DELIMITER = ',' : string

WYSIWYG対象フィールドの区切り文字

FIND_LIMIT_UPLOAD_FILE

FIND_LIMIT_UPLOAD_FILE = 1000 : string

1000件ずつアップロードファイルのデータを取得するようにする

HOW_TO_BACKUP_URL

HOW_TO_BACKUP_URL = 'https://www.netcommons.org/NetCommons3/download#!#frame-362' : string

バックアップ方法URL

DELETE_EXTENSION_DELIMITER

DELETE_EXTENSION_DELIMITER = ',' : string

削除する拡張子の区切り文字

Properties

$actsAs

$actsAs : array

use behaviors

Type

array

$validate

$validate : array

Validation rules

Type

array

$useDbConfig

$useDbConfig : string

Use database config

Type

string

$blockId

$blockId : string

ブロックId Behaviorで関連データ削除する際に使用する

Type

string

$blockKey

$blockKey : string

ブロックKey Behaviorで関連データ削除する際に使用する

Type

string

$contentKey

$contentKey : string

コンテンツKey Behaviorで関連データ削除する際に使用する

Type

string

$deleteDelayDay

$deleteDelayDay : string

削除遅延日 x日前<br /> 例えば1日前を指定すると、今日アップしたファイルは消さなくなります

Type

string

$deleteExtension

$deleteExtension : string

削除する拡張子<br /> (例 jpg、複数はカンマ区切り、空なら全ての拡張子が対象)

Type

string

$UploadFile

$UploadFile : \UploadFile

Type

\UploadFile

$__changeDbConfig

$__changeDbConfig : string

接続先DB master slave変更用

Type

string

$__oldSlaveDbConfig

$__oldSlaveDbConfig : string

接続先DB 古いslave保存用

Type

string

Methods

__construct()

__construct() : void

construct

setMasterDataSource()

setMasterDataSource() : void

Masterの接続先に変更する。

setSlaveDataSource()

setSlaveDataSource() : void

以前のSlaveの接続先に戻す。なければ、ランダムに選択

getDataSource()

getDataSource() : \DataSource

Gets the DataSource to which this model is bound.

Returns

\DataSource —

A DataSource object

create()

create(boolean|array  $data = array(), boolean  $filterKey = false) : array

NetCommonsで使用する共通の値がセットされた結果を返します。<br> CakePHPのSchemaは、not null指定されたカラムのdefaultがnullになっているため、<br> ''(長さ0の文字列)に書き換えています。<br> https://github.com/NetCommons3/NetCommons3/issues/7

セットされるデータ

'room_id' => Current::read('Room.id'),
'language_id' => Current::read('Language.id'),
'block_id' => Current::read('Block.id'),
'block_key' => Current::read('Block.key'),
'frame_id' => Current::read('Frame.id'),
'frame_key' => Current::read('Frame.key'),
'plugin_key' => Inflector::underscore($this->plugin),

Parameters

boolean|array $data

Optional data array to assign to the model after it is created. If null or false, schema data defaults are not merged.

boolean $filterKey

If true, overwrites any primary key input with an empty value

Returns

array —

The current Model::data; after merging $data and/or defaults from database

createAll()

createAll(boolean|array  $data = array(), boolean  $filterKey = false) : array

Initializes the model for writing a new record, loading the default values for those fields that are not defined in $data, and clearing previous validation errors.

Especially helpful for saving data in loops.

Parameters

boolean|array $data

Optional data array to assign to the model after it is created. If null or false, schema data defaults are not merged.

boolean $filterKey

If true, overwrites any primary key input with an empty value

Returns

array —

The current Model::data; after merging $data and/or defaults from database

begin()

begin() : void

transaction begin

commit()

commit() : void

transaction commit

rollback()

rollback(mixed  $ex = null) : void

transaction rollback

Parameters

mixed $ex

Exception

Throws

\Exception

loadModels()

loadModels(array  $models = array()) : void

Load models

Parameters

array $models

models to load

beforeValidate()

beforeValidate(array  $options = array()) : boolean

Called during validation operations, before validation. Please note that custom validation rules can be defined in $validate.

Parameters

array $options

Options passed from Model::save().

Returns

boolean —

True if validate operation should continue, false to abort

isLockFile()

isLockFile(array  $check) : boolean

独自バリデーション<br /> isLockFile ロックファイルの存在確認

Parameters

array $check

チェック値

Returns

boolean

findCleanUpsAndPlugin()

findCleanUpsAndPlugin(array  $data = null) : array

ファイルクリーンアップ対象プラグインデータ ゲット

Parameters

array $data

received post data. ex) ['CleanUp']['plugin_key'][] = 'announcements'

Returns

array

validatesOnly()

validatesOnly(array  $data) : mixed

入力チェックのみ行う

Parameters

array $data

received post data. ['CleanUp']['plugin_key'][] = 'announcements'

Returns

mixed —

On success Model::$data if its not empty or true, false on failure

fileCleanUp()

fileCleanUp(array  $data) : mixed

ファイルクリーンアップ

Parameters

array $data

received post data. ['CleanUp']['plugin_key'][] = 'announcements'

Throws

\Exception

Returns

mixed —

On success Model::$data if its not empty or true, false on failure

getUploadFileParams()

getUploadFileParams(array  $cleanUp) : array

アップロードファイルのfind条件 ゲット テスト利用のためpublicに変更

Parameters

array $cleanUp

request->data 1件

Returns

array

_getDefaultValue()

_getDefaultValue() : array

全カラムのデフォルト値をセットした配列を返す。

Returns

array —

デフォルト値をセットした配列

_doSave()

_doSave(array  $data = null, array  $options = array()) : mixed

cakephpの登録処理をオーバーライド

cakephpのsave時にcreated,modifiedの項目にセットする時間が、date_default_timezone_setに影響してしまうため、 登録直前にUTCに変更し、登録後にdate_default_timezone_setを元に戻すため、オーバライドする

Parameters

array $data

Data to save.

array $options

can have following keys:

  • validate: Set to true/false to enable or disable validation.
  • fieldList: An array of fields you want to allow for saving.
  • callbacks: Set to false to disable callbacks. Using 'before' or 'after' will enable only those callbacks.
  • counterCache: Boolean to control updating of counter caches (if any)

Throws

\PDOException

Returns

mixed —

On success Model::$data if its not empty or true, false on failure

_readDataSource()

_readDataSource(string  $type, array  $query) : array

Findの結果をキャッシュする際、afterFindは実行させたいので、CakeのModelを継承して、カスタマイズする。

Parameters

string $type

Type of find operation (all / first / count / neighbors / list / threaded)

array $query

Option fields (conditions / fields / joins / limit / offset / order / page / group / callbacks)

Returns

array

__getRandomlySlave()

__getRandomlySlave() : string

Find the slaves we have

Returns

string —

The name of the DataSource, as defined in app/Config/database.php

__changeDataSource()

__changeDataSource() : void

MasterDBに切り替える処理

__deleteUploadFiles()

__deleteUploadFiles(array  $uploadFiles, array  $cleanUp, integer  $targetCount) : integer

Delete uploadFiles

Parameters

array $uploadFiles

UploadFiles

array $cleanUp

request->data 1件

integer $targetCount

削除対象件数

Returns

integer —

削除対象件数

__isOverDelayDate()

__isOverDelayDate(array  $uploadFile) : boolean

削除遅延日以上かどうか<br /> 該当するファイルは削除対象外になります

Parameters

array $uploadFile

UploadFile

Returns

boolean —

true:削除遅延日以上|false:使ってない

__deleteUploadFile()

__deleteUploadFile(array  $uploadFile) : boolean

Delete uploadFile

Parameters

array $uploadFile

UploadFile

Returns

boolean

__isUseUploadFile()

__isUseUploadFile(array  $uploadFile, array  $cleanUp) : boolean

このコンテンツでアップロードファイルを使っているかどうか。

Parameters

array $uploadFile

UploadFile

array $cleanUp

[CleanUp][...]

Returns

boolean —

true:使ってる|false:使ってない