Completed
Pull Request — master (#8)
by Anton
02:06
created

Crud::setUploadDir()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 14
rs 9.2
cc 4
eloc 7
nc 3
nop 1
1
<?php
2
/**
3
 * @copyright Bluz PHP Team
4
 * @link https://github.com/bluzphp/skeleton
5
 */
6
7
declare(strict_types=1);
8
9
namespace Application\Media;
10
11
use Bluz\Proxy\Request;
12
13
/**
14
 * Class Crud of Media
15
 * @package Application\Media
16
 *
17
 * @method Table getTable()
18
 */
19
class Crud extends \Bluz\Crud\Table
20
{
21
    /**
22
     * createOne
23
     *
24
     * @param array $data
25
     * @throws \Application\Exception
26
     * @return integer
27
     */
28
    public function createOne($data)
29
    {
30
        /**
31
         * @var Row $row
32
         */
33
        $row = $this->getTable()->create();
34
35
        $data = $this->filterData($data);
36
37
        $row->setFromArray($data);
38
39
        /**
40
         * Process HTTP File
41
         */
42
        $row->processRequestFile(Request::getFile('file'));
43
44
        return $row->save();
45
    }
46
}
47