ModelInterface::getId()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 1
1
<?php
2
/**
3
 * This file contains the skeleton for all of the database objects
4
 *
5
 * @package    BZiON\Models
6
 * @license    https://github.com/allejo/bzion/blob/master/LICENSE.md GNU General Public License Version 3
7
 */
8
9
/**
10
 * A base database object interface
11
 * @package    BZiON\Models
12
 */
13
interface ModelInterface
14
{
15
    /**
16
     * Delete the object
17
     *
18
     * Please note that this does not delete the object entirely from the database,
19
     * it only hides it from users. You should overload this function if your object
20
     * does not have a 'status' column which can be set to 'deleted'.
21
     * @return void
22
     */
23
    public function delete();
24
25
    /**
26
     * Undo the deletion of a model marked as "deleted" in the database
27
     * @return void
28
     */
29
    public function restore();
30
31
    /**
32
     * Permanently delete the object from the database
33
     * @return void
34
     */
35
    public function wipe();
36
37
    /**
38
     * Get an object's database ID
39
     * @return int The ID
40
     */
41
    public function getId();
42
43
    /**
44
     * See if an object is valid
45
     * @return bool
46
     */
47
    public function isValid();
48
49
    /**
50
     * Check if a status of the object is 'deleted'
51
     * @return bool
52
     */
53
    public function isDeleted();
54
55
    /**
56
     * Gets an entity from the supplied slug, which can either be an alias or an ID
57
     * @param  string|int $slug The object's slug
58
     * @return Model
59
     */
60
    public static function fetchFromSlug($slug);
61
62
    /**
63
     * Generate an invalid object
64
     *
65
     * <code>
66
     *     <?php
67
     *     $object = Team::invalid();
68
     *
69
     *     get_class($object); // Team
70
     *     $object->isValid(); // false
71
     * </code>
72
     * @return Model
73
     */
74
    public static function invalid();
75
}
76