1 | <?php |
||
19 | class Comment extends ContentAbstract |
||
20 | { |
||
21 | /** |
||
22 | * name of the table |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | |||
27 | protected $_table = 'comments'; |
||
28 | |||
29 | /** |
||
30 | * count the comments by article and language |
||
31 | * |
||
32 | * @since 4.0.0 |
||
33 | * |
||
34 | * @param int $articleId identifier of the article |
||
35 | * @param string $language |
||
36 | * |
||
37 | * @return int|null |
||
38 | */ |
||
39 | |||
40 | 4 | public function countByArticleAndLanguage(int $articleId = null, string $language = null) : ?int |
|
52 | |||
53 | /** |
||
54 | * max id by article and language |
||
55 | * |
||
56 | * @since 4.5.0 |
||
57 | * |
||
58 | * @param int $articleId identifier of the article |
||
59 | * @param string $language |
||
60 | * |
||
61 | * @return int|null |
||
62 | */ |
||
63 | |||
64 | public function maxIdByArticleAndLanguage(int $articleId = null, string $language = null) : ?int |
||
65 | { |
||
66 | return $this |
||
67 | ->query() |
||
68 | ->where( |
||
69 | [ |
||
70 | 'article' => $articleId, |
||
71 | 'status' => 1 |
||
72 | ]) |
||
73 | ->whereLanguageIs($language) |
||
74 | ->max('id') ? : null; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * get the comments by article and language and order and step |
||
79 | * |
||
80 | * @since 4.0.0 |
||
81 | * |
||
82 | * @param int $articleId identifier of the article |
||
83 | * @param string $language |
||
84 | * @param string $orderColumn |
||
85 | * @param int $limitStep |
||
86 | * |
||
87 | * @return object|null |
||
88 | */ |
||
89 | |||
90 | 5 | public function getByArticleAndLanguageAndOrderAndStep(int $articleId = null, string $language = null, string $orderColumn = 'rank', int $limitStep = null) : ?object |
|
107 | |||
108 | /** |
||
109 | * get the comment route by id |
||
110 | * |
||
111 | * @since 3.3.0 |
||
112 | * |
||
113 | * @param int $commentId identifier of the comment |
||
114 | * |
||
115 | * @return string|null |
||
116 | */ |
||
117 | |||
118 | 4 | public function getRouteById(int $commentId = null) : ?string |
|
143 | |||
144 | /** |
||
145 | * create the comment by array |
||
146 | * |
||
147 | * @since 3.3.0 |
||
148 | * |
||
149 | * @param array $createArray array of the create |
||
150 | * |
||
151 | * @return bool |
||
152 | */ |
||
153 | |||
154 | 2 | public function createByArray(array $createArray = []) : bool |
|
169 | } |
||
170 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: