Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Yeray Santana Hualde
syncEnrollments
Commits
c4ece2d5
Commit
c4ece2d5
authored
Aug 17, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rearrange __get hierarchy so eloquent models can have methods that have the same name as columns.
parent
695420c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
model.php
system/db/eloquent/model.php
+5
-5
No files found.
system/db/eloquent/model.php
View file @
c4ece2d5
...
@@ -424,9 +424,13 @@ abstract class Model {
...
@@ -424,9 +424,13 @@ abstract class Model {
*/
*/
public
function
__get
(
$key
)
public
function
__get
(
$key
)
{
{
if
(
array_key_exists
(
$key
,
$this
->
attributes
))
{
return
$this
->
attributes
[
$key
];
}
// Is the requested item a model relationship that has already been loaded?
// Is the requested item a model relationship that has already been loaded?
// All of the loaded relationships are stored in the "ignore" array.
// All of the loaded relationships are stored in the "ignore" array.
if
(
array_key_exists
(
$key
,
$this
->
ignore
))
else
if
(
array_key_exists
(
$key
,
$this
->
ignore
))
{
{
return
$this
->
ignore
[
$key
];
return
$this
->
ignore
[
$key
];
}
}
...
@@ -438,10 +442,6 @@ abstract class Model {
...
@@ -438,10 +442,6 @@ abstract class Model {
return
$this
->
ignore
[
$key
]
=
(
in_array
(
$this
->
relating
,
array
(
'has_one'
,
'belongs_to'
)))
?
$query
->
first
()
:
$query
->
get
();
return
$this
->
ignore
[
$key
]
=
(
in_array
(
$this
->
relating
,
array
(
'has_one'
,
'belongs_to'
)))
?
$query
->
first
()
:
$query
->
get
();
}
}
elseif
(
array_key_exists
(
$key
,
$this
->
attributes
))
{
return
$this
->
attributes
[
$key
];
}
}
}
/**
/**
...
...
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