Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/Entity/Record/AssignmentRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Column;
use Forumify\Core\Entity\AuditableEntityInterface;
use Forumify\Milhq\Entity\Soldier;
use Forumify\Milhq\Entity\Position;
use Forumify\Milhq\Entity\Specialty;
Expand All @@ -17,7 +18,7 @@
#[ORM\Index(fields: ['type'])]
#[ORM\Index(fields: ['soldier', 'type'])]
#[ORM\Table('milhq_record_assignment')]
class AssignmentRecord implements RecordInterface
class AssignmentRecord implements RecordInterface, AuditableEntityInterface
{
use RecordFields;

Expand Down
3 changes: 2 additions & 1 deletion src/Entity/Record/AwardRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
namespace Forumify\Milhq\Entity\Record;

use Doctrine\ORM\Mapping as ORM;
use Forumify\Core\Entity\AuditableEntityInterface;
use Forumify\Milhq\Entity\Award;
use Forumify\Milhq\Entity\Soldier;
use Forumify\Milhq\Repository\AwardRecordRepository;

#[ORM\Entity(repositoryClass: AwardRecordRepository::class)]
#[ORM\Table('milhq_record_award')]
class AwardRecord implements RecordInterface
class AwardRecord implements RecordInterface, AuditableEntityInterface
{
use RecordFields;

Expand Down
3 changes: 2 additions & 1 deletion src/Entity/Record/CombatRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
namespace Forumify\Milhq\Entity\Record;

use Doctrine\ORM\Mapping as ORM;
use Forumify\Core\Entity\AuditableEntityInterface;
use Forumify\Milhq\Entity\Soldier;
use Forumify\Milhq\Repository\CombatRecordRepository;

#[ORM\Entity(repositoryClass: CombatRecordRepository::class)]
#[ORM\Table('milhq_record_combat')]
class CombatRecord implements RecordInterface
class CombatRecord implements RecordInterface, AuditableEntityInterface
{
use RecordFields;

Expand Down
3 changes: 2 additions & 1 deletion src/Entity/Record/QualificationRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
namespace Forumify\Milhq\Entity\Record;

use Doctrine\ORM\Mapping as ORM;
use Forumify\Core\Entity\AuditableEntityInterface;
use Forumify\Milhq\Entity\Soldier;
use Forumify\Milhq\Entity\Qualification;
use Forumify\Milhq\Repository\QualificationRecordRepository;

#[ORM\Entity(repositoryClass: QualificationRecordRepository::class)]
#[ORM\Table('milhq_record_qualification')]
class QualificationRecord implements RecordInterface
class QualificationRecord implements RecordInterface, AuditableEntityInterface
{
use RecordFields;

Expand Down
3 changes: 2 additions & 1 deletion src/Entity/Record/RankRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
namespace Forumify\Milhq\Entity\Record;

use Doctrine\ORM\Mapping as ORM;
use Forumify\Core\Entity\AuditableEntityInterface;
use Forumify\Milhq\Entity\Soldier;
use Forumify\Milhq\Entity\Rank;
use Forumify\Milhq\Repository\RankRecordRepository;

#[ORM\Entity(repositoryClass: RankRecordRepository::class)]
#[ORM\Table('milhq_record_rank')]
class RankRecord implements RecordInterface
class RankRecord implements RecordInterface, AuditableEntityInterface
{
use RecordFields;

Expand Down
14 changes: 14 additions & 0 deletions src/Entity/Record/RecordFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
namespace Forumify\Milhq\Entity\Record;

use Doctrine\ORM\Mapping as ORM;
use Forumify\Core\Entity\AuditableEntityInterface;
use Forumify\Core\Entity\IdentifiableEntityTrait;
use Forumify\Core\Entity\TimestampableEntityTrait;
use Forumify\Milhq\Entity\Document;
use Forumify\Milhq\Entity\Soldier;

/**
* @phpstan-require-implements AuditableEntityInterface
*/
trait RecordFields
{
use IdentifiableEntityTrait;
Expand Down Expand Up @@ -65,4 +69,14 @@ public function setDocument(?Document $document): void
{
$this->document = $document;
}

public function getIdentifierForAudit(): string
{
return (string)$this->getId();
}

public function getNameForAudit(): string
{
return $this->getText();

@jannes-io jannes-io Jun 25, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'm actually not sure about this.

In real units, the text is very often left blank, or in other cases, the text is being used to include like a "citation" or something, which are often very long which would totally break the table.

I think it's best to remove this function from the trait, and have each record implement the function itself. Then for:

  • award records we could show the award text,
  • qualification records the qualifications,
  • rank records the rank,
  • combat records and service records we can grab the text, but we should limit it to max 32 characters.

My apologies for misguiding you in the issue.

}
}
3 changes: 2 additions & 1 deletion src/Entity/Record/ServiceRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
namespace Forumify\Milhq\Entity\Record;

use Doctrine\ORM\Mapping as ORM;
use Forumify\Core\Entity\AuditableEntityInterface;
use Forumify\Milhq\Entity\Soldier;
use Forumify\Milhq\Repository\ServiceRecordRepository;

#[ORM\Entity(repositoryClass: ServiceRecordRepository::class)]
#[ORM\Table('milhq_record_service')]
class ServiceRecord implements RecordInterface
class ServiceRecord implements RecordInterface, AuditableEntityInterface
{
use RecordFields;

Expand Down
Loading