Use named args to avoid passing default values for args

This commit is contained in:
Alejandro Celaya 2024-02-24 18:21:53 +01:00
parent c91a534d1a
commit c1e88c3e83
4 changed files with 8 additions and 8 deletions

View file

@ -30,7 +30,7 @@ return static function (ClassMetadata $metadata, array $emConfig): void {
->build(); ->build();
$builder->createManyToOne('shortUrl', ShortUrl\Entity\ShortUrl::class) $builder->createManyToOne('shortUrl', ShortUrl\Entity\ShortUrl::class)
->addJoinColumn('short_url_id', 'id', false, false, 'CASCADE') ->addJoinColumn('short_url_id', 'id', nullable: false, onDelete: 'CASCADE')
->build(); ->build();
$builder->createManyToMany('conditions', RedirectRule\Entity\RedirectCondition::class) $builder->createManyToMany('conditions', RedirectRule\Entity\RedirectCondition::class)

View file

@ -36,6 +36,6 @@ return static function (ClassMetadata $metadata, array $emConfig): void {
->build(); ->build();
$builder->createManyToOne('shortUrl', ShortUrl\Entity\ShortUrl::class) $builder->createManyToOne('shortUrl', ShortUrl\Entity\ShortUrl::class)
->addJoinColumn('short_url_id', 'id', false, false, 'CASCADE') ->addJoinColumn('short_url_id', 'id', nullable: false, onDelete: 'CASCADE')
->build(); ->build();
}; };

View file

@ -76,18 +76,18 @@ return static function (ClassMetadata $metadata, array $emConfig): void {
$builder->createManyToMany('tags', Tag\Entity\Tag::class) $builder->createManyToMany('tags', Tag\Entity\Tag::class)
->setJoinTable(determineTableName('short_urls_in_tags', $emConfig)) ->setJoinTable(determineTableName('short_urls_in_tags', $emConfig))
->addInverseJoinColumn('tag_id', 'id', true, false, 'CASCADE') ->addInverseJoinColumn('tag_id', 'id', onDelete: 'CASCADE')
->addJoinColumn('short_url_id', 'id', true, false, 'CASCADE') ->addJoinColumn('short_url_id', 'id', onDelete: 'CASCADE')
->setOrderBy(['name' => 'ASC']) ->setOrderBy(['name' => 'ASC'])
->build(); ->build();
$builder->createManyToOne('domain', Domain\Entity\Domain::class) $builder->createManyToOne('domain', Domain\Entity\Domain::class)
->addJoinColumn('domain_id', 'id', true, false, 'RESTRICT') ->addJoinColumn('domain_id', 'id', onDelete: 'RESTRICT')
->cascadePersist() ->cascadePersist()
->build(); ->build();
$builder->createManyToOne('authorApiKey', ApiKey::class) $builder->createManyToOne('authorApiKey', ApiKey::class)
->addJoinColumn('author_api_key_id', 'id', true, false, 'SET NULL') ->addJoinColumn('author_api_key_id', 'id', onDelete: 'SET NULL')
->build(); ->build();
$builder->addUniqueConstraint(['short_code', 'domain_id'], 'unique_short_code_plus_domain'); $builder->addUniqueConstraint(['short_code', 'domain_id'], 'unique_short_code_plus_domain');

View file

@ -49,11 +49,11 @@ return static function (ClassMetadata $metadata, array $emConfig): void {
->build(); ->build();
$builder->createManyToOne('shortUrl', ShortUrl\Entity\ShortUrl::class) $builder->createManyToOne('shortUrl', ShortUrl\Entity\ShortUrl::class)
->addJoinColumn('short_url_id', 'id', true, false, 'CASCADE') ->addJoinColumn('short_url_id', 'id', onDelete: 'CASCADE')
->build(); ->build();
$builder->createManyToOne('visitLocation', Visit\Entity\VisitLocation::class) $builder->createManyToOne('visitLocation', Visit\Entity\VisitLocation::class)
->addJoinColumn('visit_location_id', 'id', true, false, 'Set NULL') ->addJoinColumn('visit_location_id', 'id', onDelete: 'Set NULL')
->cascadePersist() ->cascadePersist()
->build(); ->build();