Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PHP-MySQLi-Database-Class
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
PHP-MySQLi-Database-Class
Commits
04cd1ab1
Commit
04cd1ab1
authored
Dec 20, 2016
by
Alexander Butenko
Committed by
GitHub
Dec 20, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #569 from Tom29/master
Fixed byId and provide pagination with data type
parents
0595c669
4924058a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
dbObject.php
dbObject.php
+21
-2
No files found.
dbObject.php
View file @
04cd1ab1
...
@@ -299,7 +299,7 @@ class dbObject {
...
@@ -299,7 +299,7 @@ class dbObject {
*
*
* @return dbObject|array
* @return dbObject|array
*/
*/
pr
otected
function
byId
(
$id
,
$fields
=
null
)
{
pr
ivate
function
byId
(
$id
,
$fields
=
null
)
{
$this
->
db
->
where
(
MysqliDb
::
$prefix
.
$this
->
dbTable
.
'.'
.
$this
->
primaryKey
,
$id
);
$this
->
db
->
where
(
MysqliDb
::
$prefix
.
$this
->
dbTable
.
'.'
.
$this
->
primaryKey
,
$id
);
return
$this
->
getOne
(
$fields
);
return
$this
->
getOne
(
$fields
);
}
}
...
@@ -438,6 +438,25 @@ class dbObject {
...
@@ -438,6 +438,25 @@ class dbObject {
$this
->
db
->
pageLimit
=
self
::
$pageLimit
;
$this
->
db
->
pageLimit
=
self
::
$pageLimit
;
$res
=
$this
->
db
->
paginate
(
$this
->
dbTable
,
$page
,
$fields
);
$res
=
$this
->
db
->
paginate
(
$this
->
dbTable
,
$page
,
$fields
);
self
::
$totalPages
=
$this
->
db
->
totalPages
;
self
::
$totalPages
=
$this
->
db
->
totalPages
;
if
(
$this
->
db
->
count
==
0
)
return
null
;
foreach
(
$res
as
&
$r
)
{
$this
->
processArrays
(
$r
);
$this
->
data
=
$r
;
$this
->
processAllWith
(
$r
,
false
);
if
(
$this
->
returnType
==
'Object'
)
{
$item
=
new
static
(
$r
);
$item
->
isNew
=
false
;
$objects
[]
=
$item
;
}
}
$this
->
_with
=
Array
();
if
(
$this
->
returnType
==
'Object'
)
return
$objects
;
if
(
$this
->
returnType
==
'Json'
)
return
json_encode
(
$res
);
return
$res
;
return
$res
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment