3
0

Add types, add docblocks, minor tweaks

This commit is contained in:
brabli
2026-05-07 17:10:54 +01:00
parent 3a0cb87d37
commit 45ed9329da
+40 -34
View File
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Pcm\SearchBundle\Entity;
use Pcm\SearchBundle\Repository\SearchIndexRepository;
@@ -7,67 +9,71 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SearchIndexRepository::class)]
#[ORM\Index(name: "idx_data_fulltext", columns: ["data"], flags: ["fulltext"])]
class SearchIndex
final class SearchIndex
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
private ?int $id = null;
#[ORM\Column(name: 'data', type: 'text')]
private string $searchText;
#[ORM\Column(type: 'string', length: 255)]
private $entityClass;
private string $title;
public function __construct(
#[ORM\Column(type: 'string', length: 512)]
private readonly string $entityClass,
#[ORM\Column(type: 'integer')]
private $entityId;
#[ORM\Column(type: 'text')]
private $data;
#[ORM\Column(type: 'string', length: 255)]
private $title;
private readonly int $entityId,
) {}
/**
* The primary key of this index row. Null until the row is persisted.
*/
public function getId(): ?int
{
return $this->id;
}
public function getEntityClass(): ?string
/**
* The fully-qualified class name of the indexed entity.
*/
public function getEntityClass(): string
{
return $this->entityClass;
}
public function setEntityClass(string $entityClass): self
{
$this->entityClass = $entityClass;
return $this;
}
public function getEntityId(): ?int
/**
* The primary key of the indexed entity within its own table.
*/
public function getEntityId(): int
{
return $this->entityId;
}
public function setEntityId(int $entityId): self
/**
* The concatenated searchable text for this entity. This is the value
* the fulltext index is matched against.
*/
public function getSearchText(): string
{
$this->entityId = $entityId;
return $this->searchText;
}
public function setSearchText(string $searchText): self
{
$this->searchText = $searchText;
return $this;
}
public function getData(): ?string
{
return $this->data;
}
public function setData(string $data): self
{
$this->data = $data;
return $this;
}
public function getTitle(): ?string
/**
* The human-readable title to display for this hit in search results.
*/
public function getTitle(): string
{
return $this->title;
}