1 | <?php |
||
33 | class File extends \yii\db\ActiveRecord |
||
34 | { |
||
35 | /** |
||
36 | * @inheritdoc |
||
37 | * @codeCoverageIgnore |
||
38 | * @internal |
||
39 | */ |
||
40 | public static function tableName() |
||
44 | |||
45 | /** |
||
46 | * @inheritdoc |
||
47 | * @codeCoverageIgnore |
||
48 | * @internal |
||
49 | */ |
||
50 | public function attributeLabels() |
||
68 | |||
69 | /** |
||
70 | * @inheritdoc |
||
71 | * @internal |
||
72 | */ |
||
73 | 26 | public function behaviors() |
|
84 | |||
85 | /** |
||
86 | * @internal |
||
87 | */ |
||
88 | 26 | public function beforeSave($insert) |
|
105 | |||
106 | /** |
||
107 | * Path to the file |
||
108 | * |
||
109 | * @return string |
||
110 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
111 | */ |
||
112 | 26 | public function path() |
|
122 | |||
123 | /** |
||
124 | * Fill meta info |
||
125 | * |
||
126 | * @param string $path File path |
||
127 | * @return void |
||
128 | * @SuppressWarnings(PHPMD.ElseExpression) |
||
129 | */ |
||
130 | 26 | public function fillMetaInfo($path) |
|
143 | |||
144 | /** |
||
145 | * Get extension By MimeType |
||
146 | * |
||
147 | * $param string $path File path |
||
148 | * @param string $mimeType MimeType of the file |
||
149 | * @return string |
||
150 | */ |
||
151 | 26 | private function getExtensionByMimeType($path, $mimeType) |
|
170 | |||
171 | /** |
||
172 | * Generate a name |
||
173 | * |
||
174 | * @return string |
||
175 | */ |
||
176 | 26 | public function generateName() |
|
181 | |||
182 | /** |
||
183 | * Checks whether the file is temp |
||
184 | * |
||
185 | * @return bool |
||
186 | */ |
||
187 | 9 | public function isTmp() |
|
191 | |||
192 | /** |
||
193 | * Check access |
||
194 | * |
||
195 | * @param int $ownerId The id of the owner |
||
196 | * @param int $ownerType The type of the owner |
||
197 | * @return bool |
||
198 | */ |
||
199 | 11 | public function checkAccess($ownerId, $ownerType) |
|
205 | |||
206 | /** |
||
207 | * Check access to model |
||
208 | * |
||
209 | * @param int $ownerId The id of the owner |
||
210 | * @param int $ownerType The type of the owner |
||
211 | * @return bool |
||
212 | */ |
||
213 | 11 | public function checkAccessToModel($ownerId, $ownerType) |
|
220 | |||
221 | /** |
||
222 | * Check access to file |
||
223 | * |
||
224 | * @param int $ownerId The id of the owner |
||
225 | * @param int $ownerType The type of the owner |
||
226 | * @return bool |
||
227 | */ |
||
228 | 11 | public function checkAccessToFile($ownerType) |
|
235 | |||
236 | /** |
||
237 | * Find all by owner |
||
238 | * |
||
239 | * @param int $ownerId The id of the owner |
||
240 | * @param int $ownerType The type of the owner |
||
241 | * @return array |
||
242 | */ |
||
243 | 13 | public static function findAllByOwner($ownerId, $ownerType) |
|
250 | |||
251 | /** |
||
252 | * Find one by owner |
||
253 | * |
||
254 | * @param int $ownerId The id of the owner |
||
255 | * @param int $ownerType The type of the owner |
||
256 | * @return File|null |
||
257 | */ |
||
258 | 8 | public static function findOneByOwner($ownerId, $ownerType) |
|
264 | } |
||
265 |