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
27d4b84d
Commit
27d4b84d
authored
7 years ago
by
Torsten Oppermann
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Adding Location repository
parent
cf1fdc24
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/Domain/Repository/LocationRepository.php
+46
-0
46 additions, 0 deletions
Classes/Domain/Repository/LocationRepository.php
with
46 additions
and
0 deletions
Classes/Domain/Repository/
Base
Repository.php
→
Classes/Domain/Repository/
Location
Repository.php
+
46
−
0
View file @
27d4b84d
<?php
namespace
SGalinski\SgJobs\Domain\Repository
;
/***************************************************************
...
...
@@ -25,52 +26,21 @@ namespace SGalinski\SgJobs\Domain\Repository;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
use
TYPO3\CMS\Extbase\Object\ObjectManager
;
use
TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings
;
use
TYPO3\CMS\Extbase\Persistence\QueryResultInterface
;
use
TYPO3\CMS\Extbase\Persistence\Repository
;
/**
*
Base
Repository
*
Location
Repository
*/
class
BaseRepository
extends
Repository
{
/**
* Just an example query.
*
* @param int $pageId
* @param bool $checkbox
* @return array|QueryResultInterface
*/
public
function
exampleQuery
(
$pageId
,
$checkbox
)
{
$query
=
$this
->
createQuery
();
$constraint
[]
=
$query
->
equals
(
'pid'
,
(
int
)
$pageId
);
$constraint
[]
=
$query
->
equals
(
'checkbox'
,
TRUE
);
return
$query
->
matching
(
$query
->
logicalAnd
(
$constraint
))
->
execute
();
}
class
LocationRepository
extends
Repository
{
/**
* Find all entries for backend pagination usage
*
* @param int $pageId
* @param bool $raw
* @return array|QueryResultInterface
* initializes the object
*/
public
function
findAllBackend
(
$pageId
,
$raw
)
{
$query
=
$this
->
createQuery
();
$constraint
[]
=
$query
->
equals
(
'pid'
,
(
int
)
$pageId
);
/** @var ObjectManager $objectManager */
$objectManager
=
GeneralUtility
::
makeInstance
(
ObjectManager
::
class
);
$querySettings
=
$objectManager
->
get
(
Typo3QuerySettings
::
class
);
/** @var Typo3QuerySettings $querySettings */
public
function
initializeObject
()
{
$querySettings
=
$this
->
createQuery
()
->
getQuerySettings
();
$querySettings
->
setRespectStoragePage
(
FALSE
);
$querySettings
->
setIgnoreEnableFields
(
TRUE
);
$querySettings
->
setEnableFieldsToBeIgnored
([
'disabled'
,
'starttime'
,
'endtime'
]);
return
$query
->
matching
(
$query
->
logicalAnd
(
$constraint
))
->
execute
(
$raw
);
$querySettings
->
setEnableFieldsToBeIgnored
([
'disabled'
]);
$this
->
setDefaultQuerySettings
(
$querySettings
);
}
}
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