-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDownloadCountUpBehavior.php
More file actions
47 lines (42 loc) · 1.04 KB
/
DownloadCountUpBehavior.php
File metadata and controls
47 lines (42 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* DownloadCountUpBehavior.php
*
* @author Ryuji AMANO <ryuji@ryus.co.jp>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
*/
/**
* Class DownloadCountUpBehavior
*/
final class DownloadCountUpBehavior extends ModelBehavior {
/**
* @var UploadFile UploadFile model
*/
private $__uploadFile;
/**
* setup
*
* @param Model $model model
* @param array $config config
* @return void
*/
public function setup(Model $model, $config = array()) {
$this->__uploadFile = ClassRegistry::init('Files.UploadFile');
parent::setup($model, $config);
}
/**
* ダウンロードカウントアップ
*
* @param Model $model 元モデル
* @param array $data UploadFile Model Data
* @param string $fieldName アップロードファイルフィールド名
* @return void
*/
public function downloadCountUp(Model $model, $data, $fieldName) {
$uploadFile = [
'UploadFile' => $data['UploadFile'][$fieldName]
];
$this->__uploadFile->countUp($uploadFile);
}
}