HasHooks::beforeCreate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Ronanchilvers\Orm\Features;
4
5
/**
6
 * Feature trait for model hooks
7
 *
8
 * @author Ronan Chilvers <[email protected]>
9
 */
10
trait HasHooks
11
{
12
    /************************************/
13
    /** Model Hooks *********************/
14
15
    /**
16
     * This hook fires immediately before model data is persisted to the db
17
     *
18
     * @author Ronan Chilvers <[email protected]>
19
     */
20
    protected function beforePersist()
21
    {}
22
23
    /**
24
     * Model hook for the 'loaded' event
25
     *
26
     * @author Ronan Chilvers <[email protected]>
27
     */
28 1
    protected function afterLoad()
29 1
    {}
30
31
    /**
32
     * Model hook for the 'saving' event
33
     *
34
     * Returning boolean false from this method cancels the event
35
     *
36
     * @return boolean
37
     * @author Ronan Chilvers <[email protected]>
38
     */
39
    protected function beforeSave()
40
    {}
41
42
    /**
43
     * Model hook for the 'saved' event
44
     *
45
     * @author Ronan Chilvers <[email protected]>
46
     */
47
    protected function afterSave()
48
    {}
49
50
    /**
51
     * Model hook for the 'creating' event
52
     *
53
     * Returning boolean false from this method cancels the event
54
     *
55
     * @return boolean
56
     * @author Ronan Chilvers <[email protected]>
57
     */
58
    protected function beforeCreate()
59
    {}
60
61
    /**
62
     * Model hook for the 'created' event
63
     *
64
     * @author Ronan Chilvers <[email protected]>
65
     */
66
    protected function afterCreate()
67
    {}
68
69
    /**
70
     * Model hook for the 'updating' event
71
     *
72
     * Returning boolean false from this method cancels the event
73
     *
74
     * @return boolean
75
     * @author Ronan Chilvers <[email protected]>
76
     */
77
    protected function beforeUpdate()
78
    {}
79
80
    /**
81
     * Model hook for the 'updated' event
82
     *
83
     * @author Ronan Chilvers <[email protected]>
84
     */
85
    protected function afterUpdate()
86
    {}
87
88
    /**
89
     * Model hook for the 'deleting' event
90
     *
91
     * Returning boolean false from this method cancels the event
92
     *
93
     * @return boolean
94
     * @author Ronan Chilvers <[email protected]>
95
     */
96
    protected function beforeDelete()
97
    {}
98
99
    /**
100
     * Model hook for the 'deleted' event
101
     *
102
     * @author Ronan Chilvers <[email protected]>
103
     */
104
    protected function afterDelete()
105
    {}
106
107
    /** Model Hooks *********************/
108
    /************************************/
109
}
110