1 | <?php |
||
21 | class Seo extends Model |
||
22 | { |
||
23 | /** |
||
24 | * @var string suffix for build table name for the tables stored SEO data for ActiveRecord |
||
25 | */ |
||
26 | static public $tableSuffix = 'seo'; |
||
27 | /** |
||
28 | * @var int SEO data owner model id |
||
29 | */ |
||
30 | public $model_id; |
||
31 | /** |
||
32 | * @var int SEO data condition |
||
33 | */ |
||
34 | public $condition = 0; |
||
35 | /** |
||
36 | * @var string SEO title |
||
37 | */ |
||
38 | public $title = ''; |
||
39 | /** |
||
40 | * @var string SEO keywords |
||
41 | */ |
||
42 | public $keywords = ''; |
||
43 | /** |
||
44 | * @var string SEO description |
||
45 | */ |
||
46 | public $description = ''; |
||
47 | /** |
||
48 | * @var bool new record flag |
||
49 | */ |
||
50 | protected $_isNewRecord; |
||
51 | /** |
||
52 | * @var ActiveRecord SEO data owner |
||
53 | */ |
||
54 | protected $_owner; |
||
55 | |||
56 | /** |
||
57 | * Search SEO data. If not found, will be returned new SEO model with empty data |
||
58 | * @param ActiveRecord $owner the ActiveRecord model for which to find data |
||
59 | * @param int $condition optional condition for searched SEO data |
||
60 | * @return self |
||
61 | */ |
||
62 | 1 | public static function find(ActiveRecord $owner, $condition = 0) |
|
81 | |||
82 | /** |
||
83 | * Get table name of SEO data table for ActiveRecord |
||
84 | * @param ActiveRecord $activeRecord |
||
85 | * @return string |
||
86 | */ |
||
87 | 1 | public static function tableName(ActiveRecord $activeRecord) |
|
96 | |||
97 | /** |
||
98 | * Find all SEO data. |
||
99 | * Result will be in format ['condition1'=>Seo(), 'condition2'=>Seo(), ...] |
||
100 | * @param ActiveRecord $owner the model for which to find data |
||
101 | * @return self[] |
||
102 | */ |
||
103 | 1 | public static function findAll(ActiveRecord $owner) |
|
119 | |||
120 | /** |
||
121 | * Delete all SEO data for ActiveRecord |
||
122 | * @param ActiveRecord $owner |
||
123 | */ |
||
124 | 1 | public static function deleteAll(ActiveRecord $owner) |
|
128 | |||
129 | /** |
||
130 | * @return array |
||
131 | */ |
||
132 | 1 | public function rules() |
|
138 | |||
139 | /** |
||
140 | * Save SEO data |
||
141 | */ |
||
142 | 1 | public function save() |
|
168 | |||
169 | /** |
||
170 | * Delete SEO data |
||
171 | * @return $this|bool |
||
172 | */ |
||
173 | 1 | public function delete() |
|
184 | |||
185 | /** |
||
186 | * Get isNewRecord flag |
||
187 | * @return bool |
||
188 | */ |
||
189 | 1 | public function getIsNewRecord() |
|
193 | } |
||
194 |