Skip to content
Merged
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
13 changes: 7 additions & 6 deletions config/config_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ framework:

doctrine:
dbal:
driver: 'pdo_sqlite'
memory: true
driver: 'pdo_mysql'
host: '%database_host%'
port: '%database_port%'
dbname: 'phplist'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
# orm:
# entity_managers:
# default:
# report_fields_where_declared: true

4 changes: 3 additions & 1 deletion src/Domain/Analytics/Model/LinkTrackForward.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class LinkTrackForward implements DomainModel, Identity
#[ORM\GeneratedValue]
private ?int $id = null;

#[ORM\Column(type: 'string', length: 2083, nullable: true)]
// Defined as string(255) due to MySQL limitation (actual max URL length is 2083):
// TEXT can't be indexed without a prefix, which Doctrine doesn't support.
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $url = null;

#[ORM\Column(name: 'urlhash', type: 'string', length: 32, nullable: true)]
Expand Down
4 changes: 3 additions & 1 deletion src/Domain/Configuration/Model/I18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ class I18n implements DomainModel
#[ORM\Column(type: 'string', length: 10)]
private string $lan;

// Defined as string with length due to MySQL limitation:
// TEXT columns can't be indexed without a prefix length, which Doctrine doesn't support.
#[ORM\Id]
#[ORM\Column(type: 'text')]
#[ORM\Column(type: 'string', length: 255)]
private string $original;

#[ORM\Column(type: 'text')]
Expand Down
4 changes: 3 additions & 1 deletion src/Domain/Configuration/Model/UrlCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class UrlCache implements DomainModel, Identity
#[ORM\GeneratedValue]
private ?int $id = null;

#[ORM\Column(name: 'url', type: 'string', length: 2083)]
// Defined as string(255) due to MySQL limitation (actual max URL length is 2083):
// TEXT can't be indexed without a prefix, which Doctrine doesn't support.
#[ORM\Column(name: 'url', type: 'string', length: 255)]
private string $url;

#[ORM\Column(name: 'lastmodified', type: 'integer', nullable: true)]
Expand Down
17 changes: 8 additions & 9 deletions src/TestingSupport/Traits/DatabaseTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,17 @@ protected function loadSchema(): void
$schemaTool = new SchemaTool($this->entityManager);
$metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();

$connection = $this->entityManager->getConnection();
$schemaManager = $connection->createSchemaManager();
try {
$schemaTool->createSchema($metadata);
} catch (ToolsException $e) {
$connection = $this->entityManager->getConnection();
$schemaManager = $connection->createSchemaManager();

foreach ($metadata as $classMetadata) {
$tableName = $classMetadata->getTableName();
foreach ($metadata as $classMetadata) {
$tableName = $classMetadata->getTableName();

if (!$schemaManager->tablesExist([$tableName])) {
try {
if (!$schemaManager->tablesExist([$tableName])) {
$schemaTool->createSchema([$classMetadata]);
} catch (ToolsException $e) {
// nothing to do
echo $e->getMessage();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function tearDown(): void
public function testFindReadsModelFromDatabase(): void
{
/** @var Administrator $actual */
$actual = $this->repository->find(1);
$actual = $this->repository->findOneBy(['email' => '[email protected]']);

$this->assertNotNull($actual);
$this->assertFalse($actual->isDisabled());
Expand Down
Loading