Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
WE.SpreadsheetImport
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Labels
Merge Requests
0
Merge Requests
0
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
packages
WE.SpreadsheetImport
Commits
f95f2ec3
Commit
f95f2ec3
authored
Oct 31, 2016
by
Simon Gadient
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'KIME-4583' into 'master'
[TASK] Allow only delete records by arguments See merge request
!9
parents
85e2c0ce
a374b380
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
3 deletions
+42
-3
Classes/WE/SpreadsheetImport/FrontendMappingService.php
Classes/WE/SpreadsheetImport/FrontendMappingService.php
+21
-1
Classes/WE/SpreadsheetImport/SpreadsheetImportService.php
Classes/WE/SpreadsheetImport/SpreadsheetImportService.php
+21
-2
No files found.
Classes/WE/SpreadsheetImport/FrontendMappingService.php
View file @
f95f2ec3
...
...
@@ -34,6 +34,18 @@ class FrontendMappingService {
*/
protected
$settings
;
/**
* @Flow\Inject
* @var \TYPO3\Flow\Persistence\PersistenceManagerInterface
*/
protected
$persistenceManager
;
/**
* @Flow\Inject
* @var \TYPO3\Flow\Property\PropertyMapper
*/
protected
$propertyMapper
;
/**
* @param string $context
* @param \TYPO3\Flow\Mvc\ActionRequest $request
...
...
@@ -48,8 +60,16 @@ class FrontendMappingService {
$name
=
$contextArgument
[
'name'
];
if
(
isset
(
$contextArgument
[
'static'
]))
{
$arguments
[
$name
]
=
$contextArgument
[
'static'
];
}
elseif
(
$request
->
hasArgument
(
$name
))
{
$value
=
$request
->
getArgument
(
$name
);
if
(
isset
(
$contextArgument
[
'domain'
]))
{
$object
=
$this
->
propertyMapper
->
convert
(
$value
,
$contextArgument
[
'domain'
]);
$arguments
[
$name
]
=
$this
->
persistenceManager
->
getIdentifierByObject
(
$object
);
}
else
{
$arguments
[
$name
]
=
$value
;
}
}
else
{
$arguments
[
$name
]
=
$request
->
hasArgument
(
$name
)
?
$request
->
getArgument
(
$name
)
:
NULL
;
$arguments
[
$name
]
=
NULL
;
}
}
}
...
...
Classes/WE/SpreadsheetImport/SpreadsheetImportService.php
View file @
f95f2ec3
...
...
@@ -289,6 +289,24 @@ class SpreadsheetImportService {
}
}
/**
* @param \TYPO3\Flow\Persistence\QueryInterface $query
* @param array $constraints
*/
private
function
mergeQueryConstraintsWithArguments
(
QueryInterface
$query
,
&
$constraints
)
{
$contextArguments
=
$this
->
settings
[
$this
->
spreadsheetImport
->
getContext
()][
'arguments'
];
if
(
is_array
(
$contextArguments
))
{
foreach
(
$contextArguments
as
$contextArgument
)
{
$name
=
$contextArgument
[
'name'
];
$arguments
=
$this
->
spreadsheetImport
->
getArguments
();
if
(
array_key_exists
(
$name
,
$arguments
))
{
$value
=
$arguments
[
$name
];
$constraints
[]
=
$query
->
equals
(
$name
,
$value
);
}
}
}
}
/**
* @param array $identifiers
*
...
...
@@ -296,8 +314,9 @@ class SpreadsheetImportService {
*/
private
function
findObjectsByExcludedIds
(
array
$identifiers
)
{
$query
=
$this
->
getDomainRepository
()
->
createQuery
();
$constraint
=
$query
->
logicalNot
(
$query
->
in
(
'Persistence_Object_Identifier'
,
$identifiers
));
return
$query
->
matching
(
$constraint
)
->
execute
();
$constraints
[]
=
$query
->
logicalNot
(
$query
->
in
(
'Persistence_Object_Identifier'
,
$identifiers
));
$this
->
mergeQueryConstraintsWithArguments
(
$query
,
$constraints
);
return
$query
->
matching
(
$query
->
logicalAnd
(
$constraints
))
->
execute
();
}
/**
...
...
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