PHP Class BcAppModel

既存のCakePHPプロジェクトで、設置済のAppModelと共存できるように、AppModelとは別にした。
Inheritance: extends Model
Afficher le fichier Open project: baserproject/basercms

Méthodes publiques

Свойство Type Description
$useDbConfig string DB接続設定名

Méthodes publiques

Méthode Description
__construct ( $id = false, $table = null, $ds = null ) : void コンストラクタ
addField ( array $options ) : boolean テーブルにフィールドを追加する
alphaNumeric ( $check ) : boolean 英数チェック
alphaNumericPlus ( array $check, array $options = [] ) : boolean 英数チェックプラス
bcUtileUrlencodeBlank ( array $check ) : boolean 削除文字チェック
beforeSave ( $options = [] ) : boolean beforeSave
between ( mixed $check, integer $min, integer $max ) 範囲を指定しての長さチェック
cakeError ( string $method, array $messages = [] ) Used to report user friendly errors.
changeSort ( string $id, integer $offset, array $conditions = [] ) : boolean 並び順を変更する
checkDate ( array $check ) : boolean 日付の正当性チェック
checkDateAfterThan ( $check, $target ) : boolean 指定した日付よりも新しい日付かどうかチェックする
checkDateRenge ( mixed $check, $begin, $end ) : boolean 最大のバイト数チェック - 対象となる値のサイズが、指定した最大値より短い場合、true を返す
confirm ( array $check, mixed $fields ) : boolean 2つのフィールド値を確認する
convertEncodingByArray ( array $data, string $outenc, string $inenc ) : array 配列の文字コードを変換する
dataIter ( &$results, $callback )
deconstruct ( string $field, mixed $data ) : mixed Deconstructs a complex data type (array or object) into a single field value.
delField ( array $options ) : boolean フィールドを削除する
delete ( $id = null, $cascade = true )
deleteAll ( mixed $conditions, boolean $cascade = true, boolean $callbacks = false ) : boolean Deletes multiple model records based on a set of conditions.
deleteModelCache ( ) : void Modelキャッシュを削除する
dispatchEvent ( string $name, array $params = [], $options = [] ) : mixed イベントを発火
duplicate ( array $check ) : boolean データの重複チェックを行う
editField ( array $options ) : boolean フィールド構造を変更する
emails ( array $check ) : boolean 複数のEメールチェック(カンマ区切り)
exists ( $id = null )
expects ( $arguments, boolean $reset = true ) : void 指定したモデル以外のアソシエーションを除外する
fileExt ( array $check, string $ext ) ファイルの拡張子チェック
fileSize ( array $check, integer $size ) ファイルサイズチェック
find ( string $type = 'first', array $query = [] ) : array | null Queries the datasource and returns a result set array.
findExpanded ( ) : array Key Value 形式のテーブルよりデータを取得して 1レコードとしてデータを展開する
getChildIdsList ( mixed $id ) : array 子カテゴリのIDリストを取得する
getControlSource ( $field ) : array コントロールソースを取得する
getMax ( string $field, array $conditions = [] ) : integer 指定フィールドのMAX値を取得する
halfText ( array $check ) : boolean 半角チェック
initDb ( $pluginName = '', $options = [] ) : boolean データベースを初期化
isPublish ( boolean $status, string $publishBegin, string $publishEnd ) : boolean データが公開済みかどうかチェックする
loadCsv ( $dbConfigName, $path, $options = [] ) : boolean CSVを読み込む
loadSchema ( $dbConfigName, $path, $filterTable = '', $filterType = '', $excludePath = [], $dropField = true ) : boolean スキーマファイルを利用してデータベース構造を変更する
maxByte ( mixed $check, integer $max ) : boolean 最大のバイト数チェック - 対象となる値のサイズが、指定した最大値より短い場合、true を返す
maxLength ( mixed $check, integer $max ) 最長の長さチェック - 対象となる値の長さが、指定した最長値より短い場合、trueを返す
minLength ( mixed $check, integer $min ) : boolean 最短の長さチェック - 対象となる値の長さが、指定した最短値より長い場合、trueを返す
notFileEmpty ( array $check ) : boolean ファイルが送信されたかチェックするバリデーション
notInList ( array $check, array $list ) : boolean リストチェック 対象となる値がリストに含まれる場合はエラー
removeFromTreeRecursive ( integer $id ) : boolean ツリーより再帰的に削除する
renameField ( array $options ) : boolean フィールド名を変更する
replaceText ( $str ) : string 機種依存文字の変換処理
save ( array $data = null, boolean $validate = true, array $fieldList = [] ) : mixed Saves model data to the database. By default, validation occurs before save.
saveDbLog ( string $message ) : boolean データベースログを記録する
saveKeyValue ( array $data ) : boolean Key Value 形式のテーブルにデータを保存する
sortdown ( string $id, array $conditions ) : boolean 一つ位置を下げる
sortup ( string $id, array $conditions ) : boolean 一つ位置を上げる
tableExists ( string $tableName ) : boolean テーブルの存在チェックを行う
updateAll ( array $fields, mixed $conditions = true ) : boolean Updates multiple model records based on a set of conditions.

Method Details

__construct() public méthode

コンストラクタ
public __construct ( $id = false, $table = null, $ds = null ) : void
Résultat void

addField() public méthode

テーブルにフィールドを追加する
public addField ( array $options ) : boolean
$options array [ field / column / table ]
Résultat boolean

alphaNumeric() public méthode

英数チェック
public alphaNumeric ( $check ) : boolean
Résultat boolean

alphaNumericPlus() public méthode

ハイフンアンダースコアを許容
public alphaNumericPlus ( array $check, array $options = [] ) : boolean
$check array チェック対象文字列
$options array 他に許容する文字列
Résultat boolean

bcUtileUrlencodeBlank() public méthode

BcUtile::urlencode で、削除される文字のみで構成されているかチェック(結果ブランクになるためnotBlankになる確認)
public bcUtileUrlencodeBlank ( array $check ) : boolean
$check array チェック対象文字列
Résultat boolean

beforeSave() public méthode

beforeSave
public beforeSave ( $options = [] ) : boolean
Résultat boolean

between() public méthode

範囲を指定しての長さチェック
public between ( mixed $check, integer $min, integer $max )
$check mixed 対象となる値
$min integer 値の最短値
$max integer 値の最長値

cakeError() public méthode

If there is a file app/error.php or app/app_error.php this file will be loaded error.php is the AppError class it should extend ErrorHandler class.
public cakeError ( string $method, array $messages = [] )
$method string Method to be called in the error class (AppError or ErrorHandler classes)
$messages array Message that is to be displayed by the error class

changeSort() public méthode

並び順を変更する
public changeSort ( string $id, integer $offset, array $conditions = [] ) : boolean
$id string
$offset integer
$conditions array
Résultat boolean

checkDate() public méthode

日付の正当性チェック
public checkDate ( array $check ) : boolean
$check array 確認する値
Résultat boolean

checkDateAfterThan() public méthode

指定した日付よりも新しい日付かどうかチェックする
public checkDateAfterThan ( $check, $target ) : boolean
$check
$target
Résultat boolean

checkDateRenge() public méthode

最大のバイト数チェック - 対象となる値のサイズが、指定した最大値より短い場合、true を返す
public checkDateRenge ( mixed $check, $begin, $end ) : boolean
$check mixed 対象となる値
Résultat boolean

confirm() public méthode

2つのフィールド値を確認する
public confirm ( array $check, mixed $fields ) : boolean
$check array 対象となる値
$fields mixed フィールド名
Résultat boolean

convertEncodingByArray() public méthode

TODO GLOBAL グローバルな関数として再配置する必要あり
public convertEncodingByArray ( array $data, string $outenc, string $inenc ) : array
$data array 変換前のデータ
$outenc string 変換後の文字コード
$inenc string 変換元の文字コード
Résultat array 変換後のデータ

dataIter() public méthode

public dataIter ( &$results, $callback )

deconstruct() public méthode

Deconstructs a complex data type (array or object) into a single field value.
public deconstruct ( string $field, mixed $data ) : mixed
$field string The name of the field to be deconstructed
$data mixed An array or object to be deconstructed into a field
Résultat mixed The resulting data that should be assigned to a field

delField() public méthode

フィールドを削除する
public delField ( array $options ) : boolean
$options array [ field / table ]
Résultat boolean

delete() public méthode

public delete ( $id = null, $cascade = true )

deleteAll() public méthode

Deletes multiple model records based on a set of conditions.
public deleteAll ( mixed $conditions, boolean $cascade = true, boolean $callbacks = false ) : boolean
$conditions mixed Conditions to match
$cascade boolean Set to true to delete records that depend on this record
$callbacks boolean Run callbacks (not being used)
Résultat boolean True on success, false on failure

deleteModelCache() public méthode

Modelキャッシュを削除する
public deleteModelCache ( ) : void
Résultat void

dispatchEvent() public méthode

イベントを発火
public dispatchEvent ( string $name, array $params = [], $options = [] ) : mixed
$name string
$params array
Résultat mixed

duplicate() public méthode

データの重複チェックを行う
public duplicate ( array $check ) : boolean
$check array
Résultat boolean false 重複あり / true 重複なし

editField() public méthode

フィールド構造を変更する
public editField ( array $options ) : boolean
$options array [ field / column / table ]
Résultat boolean

emails() public méthode

複数のEメールチェック(カンマ区切り)
public emails ( array $check ) : boolean
$check array 複数のメールアドレス
Résultat boolean

exists() public méthode

public exists ( $id = null )

expects() public méthode

指定したモデル以外のアソシエーションを除外する
public expects ( $arguments, boolean $reset = true ) : void
$reset boolean バインド時に1回の find でリセットするかどうか
Résultat void

fileExt() public méthode

ファイルの拡張子チェック
public fileExt ( array $check, string $ext )
$check array チェック対象データ
$ext string 許可する拡張子

fileSize() public méthode

ファイルサイズチェック
public fileSize ( array $check, integer $size )
$check array チェック対象データ
$size integer 最大のファイルサイズ

find() public méthode

Used to perform find operations, where the first argument is type of find operation to perform (all / first / count / neighbors / list / threaded), second parameter options for finding (indexed array, including: 'conditions', 'limit', 'recursive', 'page', 'fields', 'offset', 'order', 'callbacks') Eg: {{{ $model->find('all', array( 'conditions' => array('name' => 'Thomas Anderson'), 'fields' => array('name', 'email'), 'order' => 'field3 DESC', 'recursive' => 2, 'group' => 'type', 'callbacks' => false, )); }}} In addition to the standard query keys above, you can provide Datasource, and behavior specific keys. For example, when using a SQL based datasource you can use the joins key to specify additional joins that should be part of the query. {{{ $model->find('all', array( 'conditions' => array('name' => 'Thomas Anderson'), 'joins' => array( array( 'alias' => 'Thought', 'table' => 'thoughts', 'type' => 'LEFT', 'conditions' => 'Thought.person_id = Person.id' ) ) )); }}} ### Disabling callbacks The callbacks key allows you to disable or specify the callbacks that should be run. To disable beforeFind & afterFind callbacks set 'callbacks' => false in your options. You can also set the callbacks option to 'before' or 'after' to enable only the specified callback. ### Adding new find types Behaviors and find types can also define custom finder keys which are passed into find(). See the documentation for custom find types (http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#creating-custom-find-types) for how to implement custom find types. Specifying 'fields' for notation 'list': - If no fields are specified, then 'id' is used for key and 'model->displayField' is used for value. - If a single field is specified, 'id' is used for key and specified field is used for value. - If three fields are specified, they are used (in order) for key, value and group. - Otherwise, first and second fields are used for key and value. Note: find(list) + database views have issues with MySQL 5.0. Try upgrading to MySQL 5.1 if you have issues with database views. Note: find(count) has its own return values.
public find ( string $type = 'first', array $query = [] ) : array | null
$type string Type of find operation (all / first / count / neighbors / list / threaded)
$query array Option fields (conditions / fields / joins / limit / offset / order / page / group / callbacks)
Résultat array | null Array of records, or Null on failure.

findExpanded() public méthode

Key Value 形式のテーブルよりデータを取得して 1レコードとしてデータを展開する
public findExpanded ( ) : array
Résultat array

getChildIdsList() public méthode

treeビヘイビア要
public getChildIdsList ( mixed $id ) : array
$id mixed ページカテゴリーID
Résultat array

getControlSource() public méthode

継承先でオーバーライドする事
public getControlSource ( $field ) : array
Résultat array

getMax() public méthode

現在数値フィールドのみ対応
public getMax ( string $field, array $conditions = [] ) : integer
$field string
$conditions array
Résultat integer

halfText() public méthode

半角チェック
public halfText ( array $check ) : boolean
$check array 確認する値を含む配列。先頭の要素のみチェックされる
Résultat boolean

initDb() public méthode

既に存在するテーブルは上書きしない
public initDb ( $pluginName = '', $options = [] ) : boolean
Résultat boolean

isPublish() public méthode

データが公開済みかどうかチェックする
public isPublish ( boolean $status, string $publishBegin, string $publishEnd ) : boolean
$status boolean 公開ステータス
$publishBegin string 公開開始日時
$publishEnd string 公開終了日時
Résultat boolean

loadCsv() public méthode

CSVを読み込む
public loadCsv ( $dbConfigName, $path, $options = [] ) : boolean
Résultat boolean

loadSchema() public méthode

スキーマファイルを利用してデータベース構造を変更する
public loadSchema ( $dbConfigName, $path, $filterTable = '', $filterType = '', $excludePath = [], $dropField = true ) : boolean
Résultat boolean

maxByte() public méthode

最大のバイト数チェック - 対象となる値のサイズが、指定した最大値より短い場合、true を返す
public maxByte ( mixed $check, integer $max ) : boolean
$check mixed 対象となる値
$max integer バイト数の最大値
Résultat boolean

maxLength() public méthode

最長の長さチェック - 対象となる値の長さが、指定した最長値より短い場合、trueを返す
public maxLength ( mixed $check, integer $max )
$check mixed 対象となる値
$max integer 値の最長値

minLength() public méthode

最短の長さチェック - 対象となる値の長さが、指定した最短値より長い場合、trueを返す
public minLength ( mixed $check, integer $min ) : boolean
$check mixed 対象となる値
$min integer 値の最短値
Résultat boolean

notFileEmpty() public méthode

ファイルが送信されたかチェックするバリデーション
public notFileEmpty ( array $check ) : boolean
$check array
Résultat boolean

notInList() public méthode

リストチェック 対象となる値がリストに含まれる場合はエラー
public notInList ( array $check, array $list ) : boolean
$check array 対象となる値
$list array リスト
Résultat boolean Succcess

removeFromTreeRecursive() public méthode

ツリーより再帰的に削除する
public removeFromTreeRecursive ( integer $id ) : boolean
$id integer
Résultat boolean

renameField() public méthode

フィールド名を変更する
public renameField ( array $options ) : boolean
$options array [ new / old / table ]
Résultat boolean

replaceText() public méthode

内部文字コードがUTF-8である必要がある。 多次元配列には対応していない。
public replaceText ( $str ) : string
Résultat string 変換後文字列 TODO AppExModeに移行すべきかも

save() public méthode

Saves model data to the database. By default, validation occurs before save.
public save ( array $data = null, boolean $validate = true, array $fieldList = [] ) : mixed
$data array Data to save.
$validate boolean If set, validation will be done before the save
$fieldList array List of fields to allow to be written
Résultat mixed On success Model::$data if its not empty or true, false on failure

saveDbLog() public méthode

データベースログを記録する
public saveDbLog ( string $message ) : boolean
$message string
Résultat boolean

saveKeyValue() public méthode

Key Value 形式のテーブルにデータを保存する
public saveKeyValue ( array $data ) : boolean
$data array
Résultat boolean

sortdown() public méthode

一つ位置を下げる
public sortdown ( string $id, array $conditions ) : boolean
$id string
$conditions array
Résultat boolean

sortup() public méthode

一つ位置を上げる
public sortup ( string $id, array $conditions ) : boolean
$id string
$conditions array
Résultat boolean

tableExists() public méthode

テーブルの存在チェックを行う
public tableExists ( string $tableName ) : boolean
$tableName string
Résultat boolean

updateAll() public méthode

Updates multiple model records based on a set of conditions.
public updateAll ( array $fields, mixed $conditions = true ) : boolean
$fields array Set of fields and values, indexed by fields. Fields are treated as SQL snippets, to insert literal values manually escape your data.
$conditions mixed Conditions to match, true for all records
Résultat boolean True on success, false on failure

Property Details

$useDbConfig public_oe property

DB接続設定名
public string $useDbConfig
Résultat string