1: <?php
2:
3: /**
4: * Deep
5: *
6: * @package rsanchez\Deep
7: * @author Rob Sanchez <info@robsanchez.com>
8: */
9:
10: namespace rsanchez\Deep\Model;
11:
12: use rsanchez\Deep\Model\AbstractField;
13: use rsanchez\Deep\Collection\MemberFieldCollection;
14:
15: /**
16: * Model for the member_fields table
17: */
18: class MemberField extends AbstractField
19: {
20: /**
21: * {@inheritdoc}
22: */
23: protected $table = 'member_fields';
24:
25: /**
26: * {@inheritdoc}
27: */
28: protected $primaryKey = 'm_field_id';
29:
30: /**
31: * {@inheritdoc}
32: *
33: * @param array $fields
34: * @return \rsanchez\Deep\Collection\MemberFieldCollection
35: */
36: public function newCollection(array $fields = array())
37: {
38: return new MemberFieldCollection($fields);
39: }
40:
41: /**
42: * {@inheritdoc}
43: */
44: public function getFieldNameAttribute($value)
45: {
46: return $this->getAttribute('m_field_name');
47: }
48:
49: /**
50: * {@inheritdoc}
51: */
52: public function getFieldIdAttribute($value)
53: {
54: return $this->getAttribute('m_field_id');
55: }
56:
57: /**
58: * {@inheritdoc}
59: */
60: public function getName()
61: {
62: return $this->m_field_name;
63: }
64:
65: /**
66: * {@inheritdoc}
67: */
68: public function getIdentifier()
69: {
70: return 'm_field_id_'.$this->m_field_id;
71: }
72:
73: /**
74: * {@inheritdoc}
75: */
76: public function getId()
77: {
78: return $this->m_field_id;
79: }
80:
81: /**
82: * {@inheritdoc}
83: */
84: public function getType()
85: {
86: return $this->m_field_type;
87: }
88: }
89: