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
21efdbf6
Commit
21efdbf6
authored
Jul 08, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove insert and update methods from Eloquent.
parent
666ebf21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
24 deletions
+11
-24
eloquent.php
system/db/eloquent.php
+11
-24
No files found.
system/db/eloquent.php
View file @
21efdbf6
...
...
@@ -303,35 +303,22 @@ abstract class Eloquent {
$this
->
timestamp
();
}
$result
=
(
$this
->
exists
)
?
$this
->
update
()
:
$this
->
insert
();
if
(
$this
->
exists
)
{
$result
=
$this
->
query
->
where
(
'id'
,
'='
,
$this
->
attributes
[
'id'
])
->
update
(
$this
->
dirty
)
==
1
;
}
else
{
$this
->
attributes
[
'id'
]
=
$this
->
query
->
insert_get_id
(
$this
->
attributes
);
$result
=
$this
->
exists
=
is_numeric
(
$this
->
id
);
}
$this
->
dirty
=
array
();
return
$result
;
}
/**
* Update an existing model in the database.
*
* @return bool
*/
private
function
update
()
{
return
$this
->
query
->
where
(
'id'
,
'='
,
$this
->
attributes
[
'id'
])
->
update
(
$this
->
dirty
)
==
1
;
}
/**
* Insert a new model into the database.
*
* @return bool
*/
private
function
insert
()
{
$this
->
attributes
[
'id'
]
=
$this
->
query
->
insert_get_id
(
$this
->
attributes
);
return
$this
->
exists
=
is_numeric
(
$this
->
id
);
}
/**
* Delete a model from the database.
*
...
...
@@ -345,7 +332,7 @@ abstract class Eloquent {
return
Query
::
table
(
static
::
table
(
get_class
(
$this
)))
->
delete
(
$this
->
id
);
}
return
0
;
return
$this
->
query
->
delete
()
;
}
/**
...
...
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