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
b921c9e0
Commit
b921c9e0
authored
Jan 01, 2016
by
KTP95
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix $obj->anotherRelatedObj === null when not exists
parent
3c8898c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
dbObject.php
dbObject.php
+14
-9
No files found.
dbObject.php
View file @
b921c9e0
...
...
@@ -16,7 +16,7 @@
* @method dbObject ObjectBuilder()
* @method mixed byId (string $id, mixed $fields)
* @method mixed get (mixed $limit, mixed $fields)
* @method mixed getOne (mixed $fields)
* @method mixed getOne (mixed $fields)
processAllWith
* @method mixed paginate (int $page, array $fields)
* @method dbObject query ($query, $numRows)
* @method dbObject rawQuery ($query, $bindParams, $sanitize)
...
...
@@ -521,18 +521,23 @@ class dbObject {
if
(
$relationType
==
'hasone'
)
{
$obj
=
new
$modelName
;
$table
=
$obj
->
dbTable
;
$primaryKey
=
$obj
->
primaryKey
;
if
(
!
isset
(
$data
[
$table
]))
{
$data
[
$name
]
=
$this
->
$name
;
continue
;
}
if
(
$this
->
returnType
==
'Object'
)
{
$item
=
new
$modelName
(
$data
[
$table
]);
$item
->
returnType
=
$this
->
returnType
;
$item
->
isNew
=
false
;
$data
[
$name
]
=
$item
;
}
if
(
$data
[
$table
][
$primaryKey
]
===
null
)
{
$data
[
$name
]
=
null
;
}
else
{
$data
[
$name
]
=
$data
[
$table
];
if
(
$this
->
returnType
==
'Object'
)
{
$item
=
new
$modelName
(
$data
[
$table
]);
$item
->
returnType
=
$this
->
returnType
;
$item
->
isNew
=
false
$data
[
$name
]
=
$item
;
}
else
{
$data
[
$name
]
=
$data
[
$table
];
}
}
unset
(
$data
[
$table
]);
}
...
...
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