1: <?php
2:
3: /**
4: * Orchestra: A minimalist object-oriented superset for WordPress using Phalcon.
5: *
6: * This source file is subject to the MIT license that is bundled
7: * with this package in the file LICENSE and is available through
8: * the world-wide-web at the following URI:
9: * http://opensource.org/licenses/MIT
10: *
11: * @copyright Akufen Atelier Creatif
12: * @author Nicholas Charbonneau <nicholas@akufen.ca>
13: * @license http://opensource.org/licenses/MIT
14: * @version 0.1.3
15: * @link https://github.com/akufenstudio/orchestra
16: */
17:
18: namespace Akufen\Orchestra\Mvc\Models;
19:
20: /**
21: * Akufen\Orchestra\Mvc\Models\TermTaxonomy
22: *
23: * A model for WordPress term taxonomy.
24: *
25: * @package Models
26: * @uses \Akufen\Orchestra\Mvc\Model
27: */
28: class TermTaxonomy extends \Akufen\Orchestra\Mvc\Model
29: {
30: /**
31: * Initialize a term's taxonomy source & relationships
32: *
33: * @return void
34: */
35: public function initialize()
36: {
37: global $table_prefix;
38:
39: $this->setSource($table_prefix . 'term_taxonomy');
40:
41: // Term taxonomy have many relationships
42: $this->hasMany(
43: 'term_taxonomy_id',
44: 'Akufen\Orchestra\Mvc\Models\TermRelationships',
45: 'term_taxonomy_id',
46: array('alias' => 'relationships')
47: );
48:
49: // Term taxonomy belong to a term
50: $this->belongsTo(
51: 'term_id',
52: 'Akufen\Orchestra\Mvc\Models\Terms',
53: 'term_id',
54: array('alias' => 'term')
55: );
56:
57: // Term taxonomy belong to a parent
58: $this->belongsTo(
59: 'parent',
60: 'Akufen\Orchestra\Mvc\Models\TermTaxonomy',
61: 'term_taxonomy_id',
62: array('alias' => 'parent')
63: );
64: }
65: }
66: