Completed
Branch 2.0.0 (814c19)
by Jimmy
03:05
created

Term_Model   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 63
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1
1
<?php
2
/**
3
 * Définition des données des terms
4
 *
5
 * @author Eoxia <[email protected]>
6
 * @since 0.1.0
7
 * @version 1.0.0
8
 * @copyright 2015-2018
9
 * @package EO_Framework\EO_Model\Model
10
 */
11
12
namespace eoxia;
13
14
if ( ! defined( 'ABSPATH' ) ) {
15
	exit;
16
}
17
18
if ( ! class_exists( '\eoxia\Term_Model' ) ) {
19
20
	/**
21
	 * Définition des données des terms
22
	 */
23
	class Term_Model extends Data_Class {
24
25
		/**
26
		 * Définition du modèle principal des taxonomies
27
		 *
28
		 * @var array Les champs principaux d'une taxonomie
29
		 */
30
		protected $schema = array();
31
32
		/**
33
		 * Le constructeur
34
		 *
35
		 * @since 0.1.0
36
		 * @version 1.0.0
37
		 *
38
		 * @param array $data       Les données de l'objet.
39
		 * @param mixed $req_method Peut être "GET", "POST", "PUT" ou null.
40
		 */
41
		public function __construct( $data = null, $req_method = null ) {
42
			$this->schema['id'] = array(
43
				'type'    => 'integer',
44
				'field'   => 'term_id',
45
				'default' => 0,
46
			);
47
48
			$this->schema['type'] = array(
49
				'type'  => 'string',
50
				'field' => 'taxonomy',
51
			);
52
53
			$this->schema['term_taxonomy_id'] = array(
54
				'type'  => 'integer',
55
				'field' => 'term_taxonomy_id',
56
			);
57
58
			$this->schema['name'] = array(
59
				'type'  => 'string',
60
				'field' => 'name',
61
			);
62
63
			$this->schema['description'] = array(
64
				'type'  => 'string',
65
				'field' => 'description',
66
			);
67
68
			$this->schema['slug'] = array(
69
				'type'  => 'string',
70
				'field' => 'slug',
71
			);
72
73
			$this->schema['parent_id'] = array(
74
				'type'  => 'integer',
75
				'field' => 'parent',
76
			);
77
78
			$this->schema['post_id'] = array(
79
				'type'  => 'integer',
80
				'field' => 'post_id',
81
			);
82
83
			parent::__construct( $data, $req_method );
84
		}
85
	}
86
}
87