Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
default_content
Commits
8fa6ca44
Commit
8fa6ca44
authored
Mar 04, 2016
by
matslats
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
import no longer crashes if uuid already exists, skips import instead
parent
6585b427
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
src/DefaultContentManager.php
src/DefaultContentManager.php
+4
-0
No files found.
src/DefaultContentManager.php
View file @
8fa6ca44
...
...
@@ -226,6 +226,10 @@ class DefaultContentManager implements DefaultContentManagerInterface {
$contents
=
$this
->
parseFile
(
$file
);
$class
=
$definition
[
'serialization_class'
];
$entity
=
$this
->
serializer
->
deserialize
(
$contents
,
$class
,
'hal_json'
,
array
(
'request_method'
=>
'POST'
));
if
(
$this
->
entityTypeManager
->
getStorage
(
$entity_type_id
)
->
loadByProperties
([
'uuid'
=>
$entity
->
uuid
()]))
{
drupal_set_message
(
t
(
'node @uuid already exists'
,
[
'@uuid'
=>
$entity
->
uuid
()]));
continue
;
}
$entity
->
enforceIsNew
(
TRUE
);
$entity
->
save
();
$created
[
$entity
->
uuid
()]
=
$entity
;
...
...
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