Commit 54bf7962 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

[TASK[ use symphony command registration via services.yaml and make statistics...

[TASK[ use symphony command registration via services.yaml and make statistics values read only for editors
parent e66e9349
Pipeline #14749 passed with stage
in 1 minute and 36 seconds
......@@ -2,6 +2,7 @@
namespace T3o\T3oMembership\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
......@@ -22,7 +23,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*
* The TYPO3 project - inspiring people to share!
*/
class MemberstatisticCommand extends \Symfony\Component\Console\Command\Command
class MemberstatisticCommand extends Command
{
/**
* @var array
......@@ -100,17 +101,14 @@ class MemberstatisticCommand extends \Symfony\Component\Console\Command\Command
->update('tx_t3omembership_domain_model_member_statistic', $memberData,
['uid' => (int)$memberStatisticUid])) {
return true;
} else {
return false;
}
} else {
$datebaseConnection = $this->getDatabaseConnection()->getConnectionForTable('tx_t3omembership_domain_model_member_statistic');
if ($datebaseConnection->insert('tx_t3omembership_domain_model_member_statistic', $memberData)) {
return true;
} else {
return false;
}
}
return false;
}
protected function createStatistic(int $pid): bool
......@@ -122,7 +120,6 @@ class MemberstatisticCommand extends \Symfony\Component\Console\Command\Command
$memberships = $statement->fetchAll();
$result = true;
foreach ($memberships as $membership) {
if ($this->createOrUpdateMemberStatistic((int)$membership['uid'], (int)$pid) === false) {
$result = false;
}
......
services:
_defaults:
autowire: true
autoconfigure: true
public: false
T3o\T3oMembership\:
resource: '../Classes/*'
T3o\T3oMembership\Command\MemberstatisticCommand:
tags:
- name: 'console.command'
command: 't3omembership:updateStatistic'
schedulable: true
......@@ -6,6 +6,7 @@ if (!defined('TYPO3_MODE')) {
return [
'ctrl' => [
'title' => 'LLL:EXT:t3o_membership/Resources/Private/Language/locallang_db.xlf:tx_t3omembership_domain_model_member_statistic',
'label' => 'Memberstatistic',
'label_alt' => 'year,month,membership',
'label_alt_force' => true,
'tstamp' => 'tstamp',
......@@ -81,7 +82,8 @@ return [
'config' => [
'type' => 'input',
'size' => 2,
'eval' => 'int, required'
'eval' => 'int, required',
'readOnly' => true
],
],
'year' => [
......@@ -90,7 +92,8 @@ return [
'config' => [
'type' => 'input',
'size' => 4,
'eval' => 'int,required'
'eval' => 'int,required',
'readOnly' => true
],
],
'count' => [
......@@ -99,7 +102,8 @@ return [
'config' => [
'type' => 'input',
'size' => 10,
'eval' => 'int,required'
'eval' => 'int,required',
'readOnly' => true
],
],
'membership' => [
......@@ -111,6 +115,7 @@ return [
'foreign_table' => 'tx_t3omembership_domain_model_membership',
'minitems' => 0,
'maxitems' => 1,
'readOnly' => true
],
],
],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment