Passed
Push — master ( 8eb7ab...fd1df3 )
by Maike
02:20
created

UsageModel   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
c 0
b 0
f 0
rs 10
wmc 1
1
<?php
2
3
4
namespace MocOrm\Usage;
5
6
use MocOrm\Model\Model;
7
8
/**
9
 *  1. Extends your model to class Model, using namespace orm\model\Model
10
 */
11
class UsageModel extends Model
12
{
13
    /**
14
     *  2. Set the static attribute $primary_key in your model
15
     *      - This is an string
16
     *      @var string
17
     */
18
    static $table_name = 'chave_composta';
19
    /**
20
     *  3. Set the static attribute $table_name in your model
21
     *      @var This is an string
22
     * @var string
23
     */
24
    static $primary_key = 'id';
25
26
    /**
27
     * Query Example
28
     *
29
     * 5. For get all data using not static method query in model, but this needed the method is instantiated in model
30
     *      @var query
31
     *      @return Array with object if exists the data
32
     *      @return Array haven't data
33
     */
34
    public function useQuery(){
35
        return $this->query('SELECT * FROM '.static::$table_name);
36
    }
37
38
39
}
40