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
9606848d
Commit
9606848d
authored
Jun 13, 2015
by
Alexander Butenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for with() and autoload()
parent
9aceb949
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
dbObject.php
dbObject.php
+6
-2
dbObjectTests.php
tests/dbObjectTests.php
+7
-0
No files found.
dbObject.php
View file @
9606848d
...
...
@@ -271,6 +271,7 @@ class dbObject {
private
function
getOne
(
$fields
=
null
)
{
$results
=
$this
->
db
->
getOne
(
$this
->
dbTable
,
$fields
);
$this
->
processArrays
(
$results
);
$this
->
data
=
$results
;
$this
->
processWith
(
$results
);
if
(
$this
->
returnType
==
'Array'
)
return
$results
;
...
...
@@ -296,6 +297,7 @@ class dbObject {
$results
=
$this
->
db
->
get
(
$this
->
dbTable
,
$limit
,
$fields
);
foreach
(
$results
as
&
$r
)
{
$this
->
processArrays
(
$r
);
$this
->
data
=
$r
;
$this
->
processWith
(
$r
);
if
(
$this
->
returnType
==
'Object'
)
{
$item
=
new
static
(
$r
);
...
...
@@ -446,6 +448,7 @@ class dbObject {
return
;
foreach
(
$this
->
_with
as
$w
)
$data
[
$w
]
=
$this
->
$w
;
$this
->
_with
=
Array
();
}
...
...
@@ -556,7 +559,8 @@ class dbObject {
}
private
static
function
dbObjectAutoload
(
$classname
)
{
$filename
=
"models/"
.
$classname
.
".php"
;
$filename
=
static
::
$modelPath
.
$classname
.
".php"
;
if
(
file_exists
(
$filename
))
include
(
$filename
);
}
...
...
tests/dbObjectTests.php
View file @
9606848d
...
...
@@ -121,6 +121,13 @@ if (!is_array ($product['userId'])) {
exit
;
}
$product
=
product
::
with
(
'userId'
)
->
byId
(
5
);
if
(
!
is_object
(
$product
->
data
[
'userId'
]))
{
echo
"Error in with processing in getOne object"
;
exit
;
}
$products
=
product
::
ArrayBuilder
()
->
with
(
'userId'
)
->
get
(
2
);
if
(
!
is_array
(
$products
[
0
][
'userId'
]))
{
echo
"Error in with processing in get"
;
...
...
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