Skip to content

Commit

Permalink
[TASK] Improve tca config
Browse files Browse the repository at this point in the history
  • Loading branch information
garbast committed Sep 13, 2024
1 parent 7462d85 commit 535e456
Show file tree
Hide file tree
Showing 14 changed files with 121 additions and 86 deletions.
1 change: 1 addition & 0 deletions Classes/Controller/AuthorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ protected function listAction(): ResponseInterface
$authors = $this->authorRepository->findAll();
}

$authors->rewind();
$this->view->assign('authorGroups', $authors);
$this->addPaginatorToView($authors);

Expand Down
5 changes: 2 additions & 3 deletions Classes/Domain/Model/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@

use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;

class Author extends AbstractEntity
{
/**
* @var ObjectStorage|LazyObjectStorage<Book>
* @var ObjectStorage<Book>
*/
#[Extbase\ORM\Lazy]
protected ObjectStorage|LazyObjectStorage $books;
protected ObjectStorage $books;

protected string $lastname = '';

Expand Down
12 changes: 6 additions & 6 deletions Classes/Domain/Model/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
class Book extends AbstractEntity
{
/**
* @var ObjectStorage|LazyObjectStorage<Author>
* @var ObjectStorage<Author>
*/
#[Extbase\ORM\Lazy]
protected ObjectStorage|LazyObjectStorage $author;
protected ObjectStorage $author;

/**
* @var ObjectStorage|LazyObjectStorage<Category>
* @var ObjectStorage<Category>
*/
#[Extbase\ORM\Lazy]
protected ObjectStorage|LazyObjectStorage $category;
protected ObjectStorage $category;

/**
* @var ObjectStorage|LazyObjectStorage<Extras>
* @var ObjectStorage<Extras>
*/
#[Extbase\ORM\Lazy]
protected ObjectStorage|LazyObjectStorage $extras;
protected ObjectStorage $extras;

/**
* @var ObjectStorage<FileReference>
Expand Down
10 changes: 5 additions & 5 deletions Classes/Domain/Model/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
class Category extends AbstractEntity
{
/**
* @var ObjectStorage|LazyObjectStorage<Category>
* @var ObjectStorage<Category>
*/
#[Extbase\ORM\Lazy]
protected ObjectStorage|LazyObjectStorage $children;
protected ObjectStorage $children;

/**
* @var ObjectStorage|LazyObjectStorage<Book>
* @var ObjectStorage<Book>
*/
#[Extbase\ORM\Lazy]
protected ObjectStorage|LazyObjectStorage $books;
protected ObjectStorage $books;

#[Extbase\ORM\Lazy]
protected null|LazyLoadingProxy|Category $parent = null;
protected Category|LazyLoadingProxy|null $parent = null;

protected string $title = '';

Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Model/Extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class Extras extends AbstractEntity
{
#[Extbase\ORM\Lazy]
protected null|LazyLoadingProxy|ExtrasLabels $label = null;
protected ExtrasLabels|LazyLoadingProxy|null $label = null;

protected int $type = 0;

Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Model/Series.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
class Series extends AbstractEntity
{
/**
* @var ObjectStorage|LazyObjectStorage<Book>
* @var ObjectStorage<Book>
*/
#[Extbase\ORM\Lazy]
protected ObjectStorage|LazyObjectStorage $books;
protected ObjectStorage $books;

protected string $title = '';

Expand Down
21 changes: 12 additions & 9 deletions Configuration/TCA/tx_sfbooks_domain_model_author.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'typeicon_classes' => [
'default' => 'sf-books-author',
],
'searchFields' => 'lastname, firstname, description',
'searchFields' => 'uid, lastname, firstname, description',
'security' => [
'ignorePageTypeRestriction' => true,
],
Expand Down Expand Up @@ -94,6 +94,7 @@
'foreign_table_where' => 'ORDER BY tx_sfbooks_domain_model_book.title',
'MM' => 'tx_sfbooks_domain_model_book_author_mm',
'MM_opposite_field' => 'author',
'relationship' => 'oneToMany',
],
],
'capital_letter' => [
Expand All @@ -110,25 +111,27 @@
lastname, firstname, path_segment, description,
--div--;' . $languageFile . 'div.references,
books,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;hidden,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,
--palette--;;visibility,
--palette--;;access,
',
],
],

'palettes' => [
'hidden' => [
'visibility' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.visibility',
'showitem' => '
hidden;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:field.default.hidden
hidden;' . $languageFile . 'tx_sfbooks_domain_model_series.hidden
',
],
'access' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access',
'showitem' => '
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel,
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.endtime_formlabel,
--linebreak--,
fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:fe_group_formlabel
fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.fe_group_formlabel
',
],
],
Expand Down
27 changes: 18 additions & 9 deletions Configuration/TCA/tx_sfbooks_domain_model_book.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'typeicon_classes' => [
'default' => 'sf-books-book',
],
'searchFields' => 'title, subtitle, isbn, description',
'searchFields' => 'uid, title, subtitle, isbn, description',
'security' => [
'ignorePageTypeRestriction' => true,
],
Expand Down Expand Up @@ -76,6 +76,7 @@
'allowed' => 'tx_sfbooks_domain_model_author',
'foreign_table' => 'tx_sfbooks_domain_model_author',
'MM' => 'tx_sfbooks_domain_model_book_author_mm',
'relationship' => 'oneToMany',
'fieldControl' => [
'editPopup' => [
'disabled' => false,
Expand Down Expand Up @@ -113,6 +114,7 @@
'foreign_table_where' => 'AND tx_sfbooks_domain_model_series.pid = ###CURRENT_PID###
ORDER BY tx_sfbooks_domain_model_series.uid',
'MM' => 'tx_sfbooks_domain_model_book_series_mm',
'relationship' => 'oneToOne',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
Expand Down Expand Up @@ -149,6 +151,7 @@
'foreign_table' => 'tx_sfbooks_domain_model_category',
'foreign_table_where' => 'ORDER BY tx_sfbooks_domain_model_category.title',
'MM' => 'tx_sfbooks_domain_model_book_category_mm',
'relationship' => 'oneToMany',
'minitems' => 0,
'maxitems' => 100,
'size' => 10,
Expand Down Expand Up @@ -229,6 +232,7 @@
'type' => 'inline',
'foreign_table' => 'tx_sfbooks_domain_model_extras',
'foreign_field' => 'book',
'relationship' => 'oneToMany',
'maxitems' => 10,
'appearance' => [
'collapseAll' => true,
Expand All @@ -253,6 +257,7 @@
'label' => $languageFile . 'tx_sfbooks_domain_model_book.cover',
'config' => [
'type' => 'file',
'relationship' => 'oneToMany',
'allowed' => 'common-image-types',
'appearance' => [
'createNewRelationLinkTitle' =>
Expand Down Expand Up @@ -302,6 +307,7 @@
'label' => $languageFile . 'tx_sfbooks_domain_model_book.cover_large',
'config' => [
'type' => 'file',
'relationship' => 'oneToMany',
'allowed' => 'common-image-types',
'appearance' => [
'createNewRelationLinkTitle' =>
Expand Down Expand Up @@ -351,6 +357,7 @@
'label' => $languageFile . 'tx_sfbooks_domain_model_book.sample_pdf',
'config' => [
'type' => 'file',
'relationship' => 'oneToMany',
'allowed' => 'pdf',
'appearance' => [
'createNewRelationLinkTitle' =>
Expand Down Expand Up @@ -406,25 +413,27 @@
isbn, series, number, category, location1, --palette--;;locations,
--div--;' . $languageFile . 'tx_sfbooks_domain_model_book.div_content,
year, description, extras, cover, cover_large, sample_pdf,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;hidden,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,
--palette--;;visibility,
--palette--;;access,
',
],
],

'palettes' => [
'hidden' => [
'visibility' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.visibility',
'showitem' => '
hidden;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:field.default.hidden
hidden;' . $languageFile . 'tx_sfbooks_domain_model_series.hidden
',
],
'access' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access',
'showitem' => '
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel,
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.endtime_formlabel,
--linebreak--,
fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:fe_group_formlabel
fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.fe_group_formlabel
',
],
'locations' => [
Expand Down
21 changes: 12 additions & 9 deletions Configuration/TCA/tx_sfbooks_domain_model_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'typeicon_classes' => [
'default' => 'sf-books-author',
],
'searchFields' => 'title, description',
'searchFields' => 'uid, title, description',
'security' => [
'ignorePageTypeRestriction' => true,
],
Expand All @@ -44,6 +44,7 @@
'renderType' => 'selectTree',
'foreign_table' => 'tx_sfbooks_domain_model_category',
'foreign_table_where' => '{#tx_sfbooks_domain_model_category}.{#uid} != ###THIS_UID### ORDER BY title',
'relationship' => 'oneToOne',
'treeConfig' => [
'parentField' => 'parent',
'appearance' => [
Expand Down Expand Up @@ -124,25 +125,27 @@
title, path_segment, description, parent, children,
--div--;' . $languageFile . 'div.references,
books,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;hidden,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,
--palette--;;visibility,
--palette--;;access,
',
],
],

'palettes' => [
'hidden' => [
'visibility' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.visibility',
'showitem' => '
hidden;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:field.default.hidden
hidden;' . $languageFile . 'tx_sfbooks_domain_model_series.hidden
',
],
'access' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access',
'showitem' => '
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel,
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.endtime_formlabel,
--linebreak--,
fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:fe_group_formlabel
fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.fe_group_formlabel
',
],
],
Expand Down
30 changes: 17 additions & 13 deletions Configuration/TCA/tx_sfbooks_domain_model_extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'typeicon_classes' => [
'default' => 'sf-books-extras',
],
'searchFields' => 'uid,label,content',
'searchFields' => 'uid, label, content',
'security' => [
'ignorePageTypeRestriction' => true,
],
Expand All @@ -37,9 +37,11 @@
'renderType' => 'selectSingle',
'default' => 0,
'size' => 1,
'maxitems' => 1,
'readOnly' => true,
'foreign_table' => 'tx_sfbooks_domain_model_book',
'foreign_table_where' => 'ORDER BY tx_sfbooks_domain_model_book.title',
'relationship' => 'oneToOne',
'items' => [
[
'label' => $languageFile . 'tx_sfbooks_domain_model_extras.book.I.0',
Expand Down Expand Up @@ -72,8 +74,8 @@
'renderType' => 'selectSingle',
'foreign_table' => 'tx_sfbooks_domain_model_extraslabels',
'foreign_table_where' => 'ORDER BY tx_sfbooks_domain_model_extraslabels.uid',
'relationship' => 'oneToOne',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
],
],
Expand All @@ -95,9 +97,9 @@
type,
label,
content,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;hidden,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,
--palette--;;visibility,
--palette--;;access,
',
],
'1' => [
Expand All @@ -107,9 +109,9 @@
type,
label,
content,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;hidden,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,
--palette--;;visibility,
--palette--;;access,
',
'columnsOverrides' => [
'content' => [
Expand All @@ -123,17 +125,19 @@
],

'palettes' => [
'hidden' => [
'visibility' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.visibility',
'showitem' => '
hidden;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:field.default.hidden
hidden;' . $languageFile . 'tx_sfbooks_domain_model_series.hidden
',
],
'access' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access',
'showitem' => '
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel,
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.endtime_formlabel,
--linebreak--,
fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:fe_group_formlabel
fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.fe_group_formlabel
',
],
],
Expand Down
Loading

0 comments on commit 535e456

Please sign in to comment.