Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Demo PR for the TYPO3 online days talk #288

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ jobs:
unit-tests:
name: "Unit tests"
runs-on: ubuntu-22.04
needs: php-lint
steps:
- name: "Checkout"
uses: actions/checkout@v4
Expand Down Expand Up @@ -197,7 +196,6 @@ jobs:
functional-tests:
name: "Functional tests"
runs-on: ubuntu-22.04
needs: php-lint
env:
DB_DATABASE: typo3
DB_USER: root
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
- name: "Checkout"
uses: actions/checkout@v4
- name: "Publish new version to TER"
uses: tomasnorre/typo3-upload-ter@v2
- uses: tomasnorre/typo3-upload-ter@v2
with:
api-token: ${{ secrets.TYPO3_API_TOKEN }}
22 changes: 17 additions & 5 deletions Classes/Domain/Model/Product/Tea.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
/**
* @Extbase\Validate("StringLength", options={"maximum": 2000})
*/
protected string $description = '';
protected string $description;

private string $internalNotes;

/**
* @var FileReference|null
* @phpstan-var FileReference|LazyLoadingProxy|null
* @Extbase\ORM\Lazy
*/
* @var FileReference|null
* @phpstan-var LazyLoadingProxy|null
* @Extbase\ORM\Lazy
*/
protected $image;

// Note: We cannot use `@var` for the more specific type annotation here as this confuses the Extbase type mapper.
Expand Down Expand Up @@ -59,12 +61,22 @@
$this->description = $description;
}

public function getInternalNotes(): string
{
return $this->internalNotes;
}

public function setInternalNotes(string $notes): void
{
$this->internalNote = $notes;

Check failure on line 71 in Classes/Domain/Model/Product/Tea.php

View workflow job for this annotation

GitHub Actions / Code quality checks (php:stan, 8.1)

Access to an undefined property TTN\Tea\Domain\Model\Product\Tea::$internalNote.
}

public function getImage(): ?FileReference
{
if ($this->image instanceof LazyLoadingProxy) {
/** @var FileReference $image */
$image = $this->image->_loadRealInstance();
$this->image = $image;

Check failure on line 79 in Classes/Domain/Model/Product/Tea.php

View workflow job for this annotation

GitHub Actions / Code quality checks (php:stan, 8.1)

Property TTN\Tea\Domain\Model\Product\Tea::$image (TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy|null) does not accept TYPO3\CMS\Extbase\Domain\Model\FileReference.
}

return $this->image;
Expand All @@ -72,7 +84,7 @@

public function setImage(FileReference $image): void
{
$this->image = $image;

Check failure on line 87 in Classes/Domain/Model/Product/Tea.php

View workflow job for this annotation

GitHub Actions / Code quality checks (php:stan, 8.1)

Property TTN\Tea\Domain\Model\Product\Tea::$image (TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy|null) does not accept TYPO3\CMS\Extbase\Domain\Model\FileReference.
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Extbase/Persistence/Classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

return [

Check failure on line 5 in Configuration/Extbase/Persistence/Classes.php

View workflow job for this annotation

GitHub Actions / Code quality checks (php:stan, 8.1)

Literal array contains empty item.
\TTN\Tea\Domain\Model\Product\Tea::class => [
'properties' => [
'ownerUid' => ['fieldName' => 'owner'],
],
],
],,
];
12 changes: 11 additions & 1 deletion Configuration/TCA/tx_tea_domain_model_product_tea.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'1' => [
'showitem' =>
'--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
title, description, image, owner,
title, description, internalNotes, image, owner,
--div--;LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.tabs.access,
--palette--;;hidden,
--palette--;;access,',
Expand Down Expand Up @@ -146,6 +146,16 @@
'eval' => 'trim',
],
],
'internalNotes' => [
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.internalNotes',
'config' => [
'type' => 'text',
'rows' => 8,
'cols' => 40,
'max' => 2000,
'eval' => 'trim',
],
],
'image' => [
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.image',
'config' => [
Expand Down
4 changes: 2 additions & 2 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ plugin.tx_tea {
}

persistence {
storagePid = {$plugin.tx_tea.persistence.storagePid}
storagePid = {$plugin.tx_tea.persistence.storagePid}
}

settings {
singleViewPageUid = {$plugin.tx_tea.settings.singleViewPageUid}
singleViewPageUid = {$plugin.tx_tea.settings.singleViewPageUid}
}
}
4 changes: 4 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<source>Description</source>
<target>Beschreibung</target>
</trans-unit>
<trans-unit id="tx_tea_domain_model_product_tea.description">
<source>Internal notes</source>
<target>Interne Notizen</target>
</trans-unit>
<trans-unit id="tx_tea_domain_model_product_tea.image">
<source>Image</source>
<target>Bild</target>
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<trans-unit id="tx_tea_domain_model_product_tea.description">
<source>Description</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_product_tea.description">
<source>Internal notes</source>
</trans-unit>
<trans-unit id="tx_tea_domain_model_product_tea.image">
<source>Image</source>
</trans-unit>
Expand Down
6 changes: 6 additions & 0 deletions Resources/Private/Templates/Tea/Show.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ <h2>
</h2>

{tea.description -> f:format.html()}

<f:if condition="{tea.internalNotes}">
<p>
{tea.internalNotes}
</p>
</f:if>
</f:section>
</html>
2 changes: 1 addition & 1 deletion Tests/Unit/Controller/TeaControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace TTN\Tea\Tests\Unit\Controller;
namespace TTN\Tea\Tests\Controller;

use PHPUnit\Framework\MockObject\MockObject;
use TTN\Tea\Controller\TeaController;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"conflict": {
"typo3/class-alias-loader": "< 1.1.0"
},
"prefer-stable": true,
"autoload": {
"psr-4": {
"TTN\\Tea\\": "Classes/"
Expand All @@ -83,6 +82,7 @@
"TTN\\Tea\\Tests\\": "Tests/"
}
},
"prefer-stable": true,
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
Expand Down
1 change: 1 addition & 0 deletions ext_tables.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CREATE TABLE tx_tea_domain_model_product_tea (
title varchar(255) DEFAULT '' NOT NULL,
description varchar(2000) DEFAULT '' NOT NULL,
internalNotes varchar(2000) DEFAULT '' NOT NULL,
image int(11) unsigned DEFAULT '0' NOT NULL,
owner int(11) unsigned DEFAULT '0' NOT NULL,

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"prettier": "^3.1.0",
"stylelint": "^15.11.0",
"stylelint-config-recommended": "^13.0.0",
"stylelint-no-browser-hacks": "^1.2.1"
"stylelint-no-browser-hacks": "^1.2.1",
}
}
Loading