-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rémi
authored and
Rémi
committed
Feb 27, 2025
1 parent
5dbbb08
commit 4931505
Showing
8 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20250227133157 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE | ||
national_event_inscription | ||
ADD | ||
referrer_id INT UNSIGNED DEFAULT NULL, | ||
ADD | ||
referrer_code VARCHAR(7) DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE | ||
national_event_inscription | ||
ADD | ||
CONSTRAINT FK_C3325557798C22DB FOREIGN KEY (referrer_id) REFERENCES adherents (id) ON DELETE | ||
SET | ||
NULL'); | ||
$this->addSql('CREATE INDEX IDX_C3325557798C22DB ON national_event_inscription (referrer_id)'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE national_event_inscription DROP FOREIGN KEY FK_C3325557798C22DB'); | ||
$this->addSql('DROP INDEX IDX_C3325557798C22DB ON national_event_inscription'); | ||
$this->addSql('ALTER TABLE national_event_inscription DROP referrer_id, DROP referrer_code'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\Adherent\Referral; | ||
|
||
class ReferralParams | ||
{ | ||
public const REFERRER_CODE = 'referrer'; | ||
|
||
public static function filterParameter(?string $parameter): ?string | ||
{ | ||
if (!$parameter) { | ||
return null; | ||
} | ||
|
||
return mb_substr($parameter, 0, 7); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% extends get_admin_template('base_list_field', admin.code) %} | ||
|
||
{% block field %} | ||
{% if object.referrer %} | ||
{{ include(('admin/adherent/_summary.html.twig'), {adherent: object.referrer}) }} | ||
{% elseif object.referrerCode %} | ||
Code: <b>{{ object.referrerCode }}</b> | ||
{% endif %} | ||
{% endblock %} |