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
5f89176a
Commit
5f89176a
authored
Jul 28, 2015
by
Alexander Butenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
9cbabeb6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
dbObject.php
dbObject.php
+18
-16
No files found.
dbObject.php
View file @
5f89176a
...
...
@@ -230,7 +230,7 @@ class dbObject {
return
false
;
$id
=
$this
->
db
->
insert
(
$this
->
dbTable
,
$sqlData
);
if
(
!
empty
(
$this
->
primaryKey
))
if
(
!
empty
(
$this
->
primaryKey
)
&&
!
isset
(
$this
->
data
[
$this
->
primaryKey
])
)
$this
->
data
[
$this
->
primaryKey
]
=
$id
;
$this
->
isNew
=
false
;
...
...
@@ -269,13 +269,9 @@ class dbObject {
* @return mixed insert id or false in case of failure
*/
public
function
save
(
$data
=
null
)
{
if
(
$this
->
isNew
)
{
$id
=
$this
->
insert
();
if
(
isset
(
$this
->
primaryKey
))
$this
->
data
[
$this
->
primaryKey
]
=
$id
;
return
$id
;
}
return
$this
->
update
(
$data
);
if
(
$this
->
isNew
)
return
$this
->
insert
();
return
$this
->
update
(
$data
);
}
/**
...
...
@@ -316,6 +312,9 @@ class dbObject {
private
function
getOne
(
$fields
=
null
)
{
$this
->
processHasOneWith
();
$results
=
$this
->
db
->
ArrayBuilder
()
->
getOne
(
$this
->
dbTable
,
$fields
);
if
(
$this
->
db
->
count
==
0
)
return
null
;
$this
->
processArrays
(
$results
);
$this
->
data
=
$results
;
$this
->
processAllWith
(
$results
);
...
...
@@ -344,6 +343,9 @@ class dbObject {
$objects
=
Array
();
$this
->
processHasOneWith
();
$results
=
$this
->
db
->
ArrayBuilder
()
->
get
(
$this
->
dbTable
,
$limit
,
$fields
);
if
(
$this
->
db
->
count
==
0
)
return
null
;
foreach
(
$results
as
&
$r
)
{
$this
->
processArrays
(
$r
);
$this
->
data
=
$r
;
...
...
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