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\Comments
22: *
23: * A model for WordPress comments
24: *
25: * @package Models
26: * @uses \Akufen\Orchestra\Mvc\Model
27: */
28: class Comments extends \Akufen\Orchestra\Mvc\Model
29: {
30: /**
31: * Initialize a comment's source & relationships
32: *
33: * @return void
34: */
35: public function initialize()
36: {
37: global $table_prefix;
38:
39: $this->setSource($table_prefix . 'comments');
40:
41: // Comments belong to an author
42: $this->belongsTo(
43: 'comment_author',
44: 'Akufen\Orchestra\Mvc\Models\Users',
45: 'ID',
46: array('alias' => 'author')
47: );
48:
49: // Comments have many comment metas
50: $this->hasMany(
51: 'comment_ID',
52: 'Akufen\Orchestra\Mvc\Models\CommentMetas',
53: 'comment_id',
54: array('alias' => 'metas')
55: );
56: }
57: }
58: