Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
maarchRM
Commits
31115261
Commit
31115261
authored
Oct 28, 2021
by
Arnaud Pauget
Browse files
Merge branch 'feat/14349_search_digital_resource' into 'develop'
Feat/14349 search digital resource See merge request
!691
parents
b644ccc6
293067ec
Pipeline
#14237
failed with stages
in 59 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bundle/digitalResource/Controller/digitalResource.php
View file @
31115261
...
...
@@ -75,6 +75,93 @@ class digitalResource
$this
->
clusters
=
[];
}
/**
* Search digital resource
* @param string $archiveId
* @param integer $sizeMin
* @param integer $sizeMax
* @param string $puid
* @param string $mimetype
* @param string $hash
* @param string $hashAlgorithm
* @param string $fileName
* @param timestamp $startDate
* @param timestamp $endDate
*/
public
function
findDocument
(
$archiveId
=
null
,
$sizeMin
=
null
,
$sizeMax
=
null
,
$puid
=
null
,
$mimetype
=
null
,
$hash
=
null
,
$hashAlgorithm
=
null
,
$fileName
=
null
,
$startDate
=
null
,
$endDate
=
null
)
{
$queryParts
=
array
();
$queryParams
=
array
();
if
(
$archiveId
!=
null
)
{
$queryParams
[
'archiveId'
]
=
$archiveId
;
$queryParts
[
'archiveId'
]
=
"archiveId = :archiveId"
;
}
if
(
$sizeMin
)
{
$queryParams
[
'sizeMin'
]
=
$sizeMin
;
$queryParts
[
'size'
]
=
"size >= :sizeMin"
;
}
if
(
$sizeMax
)
{
$queryParams
[
'sizeMax'
]
=
$sizeMax
;
$queryParts
[
'size'
]
=
"size <= :sizeMax"
;
}
if
(
$puid
!=
null
)
{
$queryParams
[
'puid'
]
=
$puid
;
$queryParts
[
'puid'
]
=
"puid = :puid"
;
}
if
(
$mimetype
!=
null
)
{
$queryParams
[
'mimetype'
]
=
$mimetype
;
$queryParts
[
'mimetype'
]
=
"mimetype = :mimetype"
;
}
if
(
$hash
!=
null
)
{
$queryParams
[
'hash'
]
=
$hash
;
$queryParts
[
'hash'
]
=
"hash = :hash"
;
}
if
(
$hashAlgorithm
!=
null
)
{
$queryParams
[
'hashAlgorithm'
]
=
$hashAlgorithm
;
$queryParts
[
'hashAlgorithm'
]
=
"hashAlgorithm = :hashAlgorithm"
;
}
if
(
$fileName
!=
null
)
{
if
(
strpos
(
$fileName
,
'*'
)
!==
false
)
{
$queryParams
[
'fileName'
]
=
str_replace
(
'*'
,
'%'
,
$fileName
);
$queryParts
[
'fileName'
]
=
"fileName ~ :fileName"
;
}
else
{
$queryParams
[
'fileName'
]
=
$fileName
;
$queryParts
[
'fileName'
]
=
"fileName = :fileName"
;
}
}
if
(
$startDate
)
{
$queryParams
[
'startDate'
]
=
$startDate
;
$queryParts
[
'created'
]
=
"created >= :startDate"
;
}
if
(
$endDate
)
{
$queryParams
[
'endDate'
]
=
$endDate
;
$queryParts
[
'created'
]
=
"created <= :endDate"
;
}
$queryString
=
implode
(
' AND '
,
$queryParts
);
return
$resources
=
$this
->
sdoFactory
->
find
(
"digitalResource/digitalResource"
,
$queryString
,
$queryParams
);
}
/**
* Get file information about one file
* @param string $filename The file name
...
...
src/bundle/digitalResource/digitalResourceInterface.php
View file @
31115261
...
...
@@ -32,4 +32,33 @@ interface digitalResourceInterface {
* @action digitalResource/digitalResource/isConvertible
*/
public
function
updateIsconvertible
(
$digitalResource
);
/**
* Search digital resource
* @param string $archiveId
* @param integer $sizeMin
* @param integer $sizeMax
* @param string $puid
* @param string $mimetype
* @param string $hash
* @param string $hashAlgorithm
* @param string $fileName
* @param timestamp $startDate
* @param timestamp $endDate
*
* @action digitalResource/digitalResource/findDocument
*/
public
function
readFinddocuments
(
$archiveId
=
null
,
$sizeMin
=
null
,
$sizeMax
=
null
,
$puid
=
null
,
$mimetype
=
null
,
$hash
=
null
,
$hashAlgorithm
=
null
,
$fileName
=
null
,
$startDate
=
null
,
$endDate
=
null
);
}
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