This repository was archived by the owner on Sep 10, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -238,13 +238,33 @@ public function findBy($var, $value)
238
238
}
239
239
$ rowset = $ this ->database ->findBy ($ var , $ value );
240
240
$ return = array ();
241
- foreach ($ rowset as $ row )
241
+
242
+ // if there are any rows, set the daoName
243
+ if (isset ($ rowset ) && sizeof ($ rowset ) > 0 )
242
244
{
243
- $ daoName = ucfirst ($ this ->_name );
244
245
if (isset ($ this ->_daoName ))
245
246
{
246
247
$ daoName = substr ($ this ->_daoName , 0 , strlen ($ this ->_daoName )-3 );
247
248
}
249
+ else
250
+ {
251
+ // can't just convert the name to dao name, in case it is in a module
252
+ if (isset ($ this ->moduleName ))
253
+ {
254
+ // we want to split the string, expecting 2 parts, module_model
255
+ // just use the model name for the dao
256
+ $ parts = explode ('_ ' , $ this ->_name );
257
+ $ daoName = ucfirst ($ parts [1 ]);
258
+ }
259
+ else
260
+ {
261
+ // if no module, just upper case the model name
262
+ $ daoName = ucfirst ($ this ->_name );
263
+ }
264
+ }
265
+ }
266
+ foreach ($ rowset as $ row )
267
+ {
248
268
$ tmpDao = $ this ->initDao ($ daoName , $ row , $ module );
249
269
$ return [] = $ tmpDao ;
250
270
unset($ tmpDao );
You can’t perform that action at this time.
0 commit comments