@@ -134,32 +134,32 @@ public function getAllSocial($code = null, $type = null, $subType = null, $field
134
134
* @param array $terms
135
135
* @return array
136
136
*/
137
- public function getSocialDql ($ vars ) {
137
+ public function getSocialDql ($ terms ) {
138
138
$ query = $ this ->getDoctrine ()->getManager ()
139
139
->createQueryBuilder ()
140
140
->select ('p ' )
141
141
->from ('AppBundle:SocialMedia ' , 'p ' );
142
142
143
- if ($ vars ['code ' ]) {
144
- $ query ->where (sprintf ("p.code = '%s' " , $ vars ['code ' ]));
143
+ if ($ terms ['code ' ]) {
144
+ $ query ->where (sprintf ("p.code = '%s' " , $ terms ['code ' ]));
145
145
}
146
146
147
- if ($ vars ['type ' ]) {
148
- $ query ->andwhere (sprintf ("p.type = '%s' " , $ vars ['type ' ]));
147
+ if ($ terms ['type ' ]) {
148
+ $ query ->andwhere (sprintf ("p.type = '%s' " , $ terms ['type ' ]));
149
149
}
150
150
151
- if ($ vars ['subType ' ]) {
152
- $ query ->andwhere (sprintf ("p.subType = '%s' " , $ vars ['subType ' ]));
151
+ if ($ terms ['subType ' ]) {
152
+ $ query ->andwhere (sprintf ("p.subType = '%s' " , $ terms ['subType ' ]));
153
153
}
154
154
155
- if ($ vars ['recent ' ]) {
156
- $ recentString = date ('Y-m-d H:i:s ' , $ vars ['recent ' ]);
155
+ if ($ terms ['recent ' ]) {
156
+ $ recentString = date ('Y-m-d H:i:s ' , $ terms ['recent ' ]);
157
157
$ query ->andWhere (sprintf ("p.postTime > '%s' " , $ recentString ));
158
158
}
159
159
160
- $ query ->setFirstResult ($ vars ['offset ' ])
161
- ->setMaxresults ($ vars ['limit ' ])
162
- ->orderBy (sprintf ("p.%s " , $ vars ['orderBy ' ]), $ vars ['direction ' ]);
160
+ $ query ->setFirstResult ($ terms ['offset ' ])
161
+ ->setMaxresults ($ terms ['limit ' ])
162
+ ->orderBy (sprintf ("p.%s " , $ terms ['orderBy ' ]), $ terms ['direction ' ]);
163
163
164
164
$ socialMedia = $ query ->getQuery ()->getResult ();
165
165
@@ -176,9 +176,11 @@ public function getSocialDql($vars) {
176
176
public function getSelectSocial ($ socialMedia , $ fields ) {
177
177
$ fields = str_replace (' ' , '' , $ fields );
178
178
$ terms = explode (', ' , $ fields );
179
+ $ out = [];
179
180
180
181
foreach ($ socialMedia as $ social ) {
181
182
$ data = $ social ->getPostData ();
183
+
182
184
$ temp = [
183
185
'code ' => $ social ->getCode (),
184
186
'type ' => $ social ->getType (),
@@ -188,7 +190,7 @@ public function getSelectSocial($socialMedia, $fields) {
188
190
189
191
foreach ($ terms as $ field ) {
190
192
191
- if ($ field == 'time ' ) {
193
+ if ($ field == 'time ' || $ field == ' date ' ) {
192
194
if ($ temp ['sub_type ' ] != 'E ' ) {
193
195
$ temp ['post_ ' . $ field ] = isset ($ data ['posted ' ]) ? $ data ['posted ' ] : null ;
194
196
0 commit comments