Commit 1cc5980bc817b2c2aa2271e9b03cdd509fd3b9c4
1 parent
e938bd52
proj model testing dev tools
Showing
1 changed file
with
83 additions
and
0 deletions
Show diff stats
1 | +<?php | |
2 | + | |
3 | +class Projects extends \Phalcon\Mvc\Model | |
4 | +{ | |
5 | + | |
6 | + /** | |
7 | + * | |
8 | + * @var integer | |
9 | + * @Primary | |
10 | + * @Column(type="integer", length=32, nullable=false) | |
11 | + */ | |
12 | + public $id; | |
13 | + | |
14 | + /** | |
15 | + * | |
16 | + * @var string | |
17 | + * @Column(type="string", length=255, nullable=true) | |
18 | + */ | |
19 | + public $name; | |
20 | + | |
21 | + /** | |
22 | + * | |
23 | + * @var integer | |
24 | + * @Column(type="integer", length=32, nullable=true) | |
25 | + */ | |
26 | + public $user_id; | |
27 | + | |
28 | + /** | |
29 | + * | |
30 | + * @var string | |
31 | + * @Column(type="string", nullable=true) | |
32 | + */ | |
33 | + public $created_at; | |
34 | + | |
35 | + /** | |
36 | + * | |
37 | + * @var string | |
38 | + * @Column(type="string", nullable=true) | |
39 | + */ | |
40 | + public $updated_at; | |
41 | + | |
42 | + /** | |
43 | + * Initialize method for model. | |
44 | + */ | |
45 | + public function initialize() | |
46 | + { | |
47 | + $this->setSchema("public"); | |
48 | + $this->belongsTo('user_id', '\User', 'id', ['alias' => 'User']); | |
49 | + } | |
50 | + | |
51 | + /** | |
52 | + * Returns table name mapped in the model. | |
53 | + * | |
54 | + * @return string | |
55 | + */ | |
56 | + public function getSource() | |
57 | + { | |
58 | + return 'projects'; | |
59 | + } | |
60 | + | |
61 | + /** | |
62 | + * Allows to query a set of records that match the specified conditions | |
63 | + * | |
64 | + * @param mixed $parameters | |
65 | + * @return Projects[]|Projects | |
66 | + */ | |
67 | + public static function find($parameters = null) | |
68 | + { | |
69 | + return parent::find($parameters); | |
70 | + } | |
71 | + | |
72 | + /** | |
73 | + * Allows to query the first record that match the specified conditions | |
74 | + * | |
75 | + * @param mixed $parameters | |
76 | + * @return Projects | |
77 | + */ | |
78 | + public static function findFirst($parameters = null) | |
79 | + { | |
80 | + return parent::findFirst($parameters); | |
81 | + } | |
82 | + | |
83 | +} | ... | ... |