Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Base lexicale BaLex
Manage
Activity
Members
Labels
Plan
Issues
18
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lex gaMe
Base lexicale BaLex
Commits
fc490bed
Commit
fc490bed
authored
2 years ago
by
Pierre Fleutot
Browse files
Options
Downloads
Patches
Plain Diff
Fix copy entry : on ne clone pas, on crée une nouvelle instance
parent
8239fd16
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Controller/ApiEntryController.php
+1
-8
1 addition, 8 deletions
src/Controller/ApiEntryController.php
src/Controller/AppBaseController.php
+15
-0
15 additions, 0 deletions
src/Controller/AppBaseController.php
src/Entity/Log.php
+5
-3
5 additions, 3 deletions
src/Entity/Log.php
with
21 additions
and
11 deletions
src/Controller/ApiEntryController.php
+
1
−
8
View file @
fc490bed
...
...
@@ -285,14 +285,7 @@ class ApiEntryController extends AppBaseController
break
;
}
}
else
{
$newEntry
=
clone
(
$entry
);
$newEntry
->
setLexicon
(
$lexicon
);
$newEntry
->
setCreatedAt
(
new
\DateTimeImmutable
());
$newEntry
->
setUpdatedAt
(
null
);
$this
->
doctrine
->
getManager
()
->
persist
(
$newEntry
);
$this
->
addLexiconLog
(
$newEntry
,
Log
::
CATEGORY_ADD_ENTRY
);
$newEntry
=
$this
->
copyEntryInLexicon
(
$entry
,
$lexicon
);
$this
->
doctrine
->
getManager
()
->
flush
();
$added
[]
=
$newEntry
->
getId
();
}
...
...
This diff is collapsed.
Click to expand it.
src/Controller/AppBaseController.php
+
15
−
0
View file @
fc490bed
...
...
@@ -368,6 +368,21 @@ class AppBaseController extends AbstractController
return
$entry
;
}
public
function
copyEntryInLexicon
(
Entry
$entry
,
Lexicon
$lexicon
)
{
$newEntry
=
new
Entry
();
$newEntry
->
setCreatedBy
(
$this
->
getUser
());
$this
->
doctrine
->
getManager
()
->
persist
(
$entry
);
$newEntry
->
setHeadword
(
$entry
->
getHeadword
());
$newEntry
->
setLanguage
(
$entry
->
getLanguage
());
$newEntry
->
setLexicon
(
$lexicon
);
$newEntry
->
setAttributes
(
$entry
->
getAttributes
());
$this
->
addLexiconLog
(
$entry
,
Log
::
CATEGORY_COPY_ENTRY
);
return
$entry
;
}
/**
* - On ajoute les commentaires de l'entrée source à la suite de ceux de l'entrée cible
* - On ajoute les items de l'entrée source à la suite de ceux de l'entrée cible
...
...
This diff is collapsed.
Click to expand it.
src/Entity/Log.php
+
5
−
3
View file @
fc490bed
...
...
@@ -20,9 +20,11 @@ class Log
const
CATEGORY_UPDATE_COMMENT
=
'update_comment'
;
const
CATEGORY_UPDATE_DISCUSSION
=
'update_discussion'
;
const
CATEGORY_UPDATE_ENTRY
=
'update_entry'
;
const
CATEGORY_ADD_ENTRY
=
'add_entry'
;
const
CATEGORY_DELETE_ENTRY
=
'delete_entry'
;
const
CATEGORY_UPDATE_ENTRY
=
'update_entry'
;
const
CATEGORY_ADD_ENTRY
=
'add_entry'
;
const
CATEGORY_COPY_ENTRY
=
'copy_entry'
;
const
CATEGORY_COPY_ENTRY_OF_THE_DAY
=
'copy_entry_of_the_day'
;
const
CATEGORY_DELETE_ENTRY
=
'delete_entry'
;
const
CATEGORY_DELETE_LABEL
=
'delete_label'
;
const
CATEGORY_RENAME_LABEL
=
'rename_label'
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment