Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_jobs
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_jobs
Commits
d8251f5b
Commit
d8251f5b
authored
1 year ago
by
Kevin von Spiczak
Browse files
Options
Downloads
Patches
Plain Diff
[FEATURE] refactor code, so that multiple storage pids can be used
parent
ead302a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!46
AZM changes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Classes/Controller/JoblistController.php
+17
-14
17 additions, 14 deletions
Classes/Controller/JoblistController.php
Classes/Domain/Repository/CompanyRepository.php
+17
-14
17 additions, 14 deletions
Classes/Domain/Repository/CompanyRepository.php
with
34 additions
and
28 deletions
Classes/Controller/JoblistController.php
+
17
−
14
View file @
d8251f5b
...
...
@@ -61,6 +61,7 @@ use TYPO3\CMS\Core\Utility\PathUtility;
use
TYPO3\CMS\Core\Utility\VersionNumberUtility
;
use
TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
;
use
TYPO3\CMS\Extbase\Mvc\Controller\ActionController
;
use
TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
;
use
TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
;
use
TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
;
use
TYPO3\CMS\Extbase\Property\Exception\TypeConverterException
;
...
...
@@ -244,12 +245,13 @@ class JoblistController extends ActionController {
}
unset
(
$filter
);
$storagePid
=
(
int
)
$this
->
configurationManager
->
getConfiguration
(
$storagePids
=
GeneralUtility
::
trimExplode
(
','
,
$this
->
configurationManager
->
getConfiguration
(
ConfigurationManagerInterface
::
CONFIGURATION_TYPE_FRAMEWORK
)[
'persistence'
][
'storagePid'
];
)[
'persistence'
][
'storagePid'
]
)
;
$this
->
assignFilterValues
(
$storagePid
,
$filters
);
$this
->
view
->
assign
(
'recordPageId'
,
$storagePid
);
$this
->
assignFilterValues
(
$storagePid
s
,
$filters
);
$this
->
view
->
assign
(
'recordPageId
s
'
,
$storagePid
s
);
$jobLimit
=
(
int
)
$this
->
settings
[
'jobLimit'
];
if
(
$jobId
)
{
...
...
@@ -305,7 +307,6 @@ class JoblistController extends ActionController {
}
$this
->
view
->
assign
(
'jobs'
,
$jobs
);
$this
->
view
->
assign
(
'jobs2'
,
'just a job'
);
$this
->
view
->
assign
(
'limit'
,
$jobLimit
);
$this
->
view
->
assign
(
'numberOfPages'
,
$numberOfPages
);
...
...
@@ -326,6 +327,7 @@ class JoblistController extends ActionController {
* @throws AspectNotFoundException
* @throws StopActionException
* @throws SiteNotFoundException
* @throws InvalidArgumentNameException
*/
public
function
applyFormAction
(
JobApplication
$applyData
=
NULL
,
...
...
@@ -384,10 +386,11 @@ class JoblistController extends ActionController {
}
$this
->
view
->
assign
(
'job'
,
$job
);
}
else
{
$storagePid
=
(
int
)
$this
->
configurationManager
->
getConfiguration
(
$storagePids
=
GeneralUtility
::
trimExplode
(
','
,
$this
->
configurationManager
->
getConfiguration
(
ConfigurationManagerInterface
::
CONFIGURATION_TYPE_FRAMEWORK
)[
'persistence'
][
'storagePid'
];
$this
->
view
->
assign
(
'companies'
,
$this
->
companyRepository
->
getAllCompanies
(
$storagePid
));
)[
'persistence'
][
'storagePid'
]
)
;
$this
->
view
->
assign
(
'companies'
,
$this
->
companyRepository
->
getAllCompanies
(
$storagePid
s
));
}
// display country options
...
...
@@ -540,7 +543,7 @@ class JoblistController extends ActionController {
* @param JobApplication $applyData
* @return ResponseInterface|null
* @throws NoSuchArgumentException
* @throws StopActionException
* @throws StopActionException
|InvalidArgumentNameException
*/
public
function
applyAction
(
JobApplication
$applyData
):
?ResponseInterface
{
$folderName
=
$this
->
request
->
getArgument
(
'folderName'
);
...
...
@@ -666,18 +669,18 @@ class JoblistController extends ActionController {
/**
* Assign filter values
*
* @param
int
$rootPageId
* @param
array
$rootPageId
s
* @param array $filters
* @throws AspectNotFoundException
*/
protected
function
assignFilterValues
(
int
$rootPageId
,
array
$filters
=
[]):
void
{
$countries
=
$this
->
companyRepository
->
getAllCountries
(
$rootPageId
,
$filters
[
'filterByLocation'
]
??
[]);
protected
function
assignFilterValues
(
array
$rootPageId
s
,
array
$filters
=
[]):
void
{
$countries
=
$this
->
companyRepository
->
getAllCountries
(
$rootPageId
s
,
$filters
[
'filterByLocation'
]
??
[]);
$this
->
view
->
assign
(
'countries'
,
$countries
);
$cities
=
$this
->
companyRepository
->
getAllCities
(
$rootPageId
,
$filters
[
'filterByLocation'
]
??
[]);
$cities
=
$this
->
companyRepository
->
getAllCities
(
$rootPageId
s
,
$filters
[
'filterByLocation'
]
??
[]);
$this
->
view
->
assign
(
'cities'
,
$cities
);
$companies
=
$this
->
companyRepository
->
getAllCompanyNames
(
$rootPageId
,
$filters
[
'filterByLocation'
]
??
[]);
$companies
=
$this
->
companyRepository
->
getAllCompanyNames
(
$rootPageId
s
,
$filters
[
'filterByLocation'
]
??
[]);
$this
->
view
->
assign
(
'companies'
,
$companies
);
$departments
=
$this
->
departmentRepository
->
findAllByFilter
(
$filters
[
'filterByDepartment'
]
??
[]);
...
...
This diff is collapsed.
Click to expand it.
Classes/Domain/Repository/CompanyRepository.php
+
17
−
14
View file @
d8251f5b
...
...
@@ -44,13 +44,13 @@ class CompanyRepository extends Repository {
/**
* Returns all countries filtered by page id
*
* @param
int
$pageUid
* @param
array
$pageUid
s
* @param array $filters
* @return array
* @throws AspectNotFoundException
*/
public
function
getAllCountries
(
int
$pageUid
,
array
$filters
=
[])
{
$result
=
$this
->
getAllCompanies
(
$pageUid
,
$filters
)
->
toArray
();
public
function
getAllCountries
(
array
$pageUid
s
,
array
$filters
=
[])
:
array
{
$result
=
$this
->
getAllCompanies
(
$pageUid
s
,
$filters
)
->
toArray
();
$countryArray
=
[];
/** @var Company $company */
...
...
@@ -69,13 +69,13 @@ class CompanyRepository extends Repository {
/**
* Returns all filtered cities
*
* @param
int
$pageUid
* @param
array
$pageUid
s
* @param array $filters
* @return array
* @throws AspectNotFoundException
*/
public
function
getAllCities
(
int
$pageUid
,
array
$filters
=
[])
{
$result
=
$this
->
getAllCompanies
(
$pageUid
,
$filters
)
->
toArray
();
public
function
getAllCities
(
array
$pageUid
s
,
array
$filters
=
[])
:
array
{
$result
=
$this
->
getAllCompanies
(
$pageUid
s
,
$filters
)
->
toArray
();
$cityArray
=
[];
/** @var Company $company */
...
...
@@ -94,13 +94,13 @@ class CompanyRepository extends Repository {
/**
* Returns all company names filtered by page id
*
* @param
int
$pageUid
* @param
array
$pageUid
s
* @param array $filters
* @return array
* @throws AspectNotFoundException
*/
public
function
getAllCompanyNames
(
int
$pageUid
,
array
$filters
=
[])
{
$result
=
$this
->
getAllCompanies
(
$pageUid
,
$filters
)
->
toArray
();
public
function
getAllCompanyNames
(
array
$pageUid
s
,
array
$filters
=
[])
:
array
{
$result
=
$this
->
getAllCompanies
(
$pageUid
s
,
$filters
)
->
toArray
();
$companyArray
=
[];
/** @var Company $company */
...
...
@@ -119,18 +119,21 @@ class CompanyRepository extends Repository {
/**
* Returns all companies filtered by page id
*
* @param
int
$pageUid
* @param
array
$pageUid
s
* @param array $filters
* @return object[]|QueryResultInterface
* @throws AspectNotFoundException
*/
public
function
getAllCompanies
(
int
$pageUid
,
array
$filters
=
[])
{
$hash
=
$pageUid
.
'_'
.
implode
(
'-'
,
$filters
);
public
function
getAllCompanies
(
array
$pageUids
,
array
$filters
=
[])
{
$hash
=
''
;
foreach
(
$pageUids
as
$pageUid
)
{
$hash
.
=
$pageUid
.
'_'
.
implode
(
'-'
,
$filters
);
}
if
(
!
isset
(
$this
->
cache
[
$hash
]))
{
$companyConstraints
=
[];
$query
=
$this
->
createQuery
();
$querySettings
=
$query
->
getQuerySettings
();
$querySettings
->
setStoragePageIds
(
[
$pageUid
]
);
$querySettings
->
setStoragePageIds
(
$pageUid
s
);
$querySettings
->
setLanguageUid
(
GeneralUtility
::
makeInstance
(
Context
::
class
)
->
getPropertyFromAspect
(
'language'
,
'id'
,
0
)
);
...
...
@@ -142,7 +145,7 @@ class CompanyRepository extends Repository {
]
);
$companyConstraints
[]
=
$query
->
equals
(
'pid'
,
$pageUid
);
$companyConstraints
[]
=
$query
->
equals
(
'pid'
,
$pageUid
s
);
if
(
count
(
$filters
)
>
0
)
{
$constraints
=
[];
foreach
(
$filters
as
$filter
)
{
...
...
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