From 7b0efddc293eb57e93a6d90e68c0c5918ec3398d Mon Sep 17 00:00:00 2001 From: lukas Date: Sat, 23 Nov 2019 16:34:54 +0200 Subject: [PATCH 01/11] test --- config/packages/easy_admin.yaml | 2 ++ src/Entity/User.php | 20 ++++++++++++++++++++ src/Form/RegistrationFormType.php | 1 + templates/registration/register.html.twig | 1 + templates/security/profile.html.twig | 1 + 5 files changed, 25 insertions(+) diff --git a/config/packages/easy_admin.yaml b/config/packages/easy_admin.yaml index a34b62ecb..92c039863 100644 --- a/config/packages/easy_admin.yaml +++ b/config/packages/easy_admin.yaml @@ -10,6 +10,7 @@ easy_admin: - 'username' - { property: 'roles', template: 'admin/user/roles-type-read.html.twig' } - { property: 'homepage', type: 'url' } + - { property: 'linkedin', type: 'url' } - { property: 'password', template: 'admin/user/password-read.html.twig' } form: fields: @@ -17,6 +18,7 @@ easy_admin: - { property: 'roles', type: 'collection' } - { property: 'plainPassword', type: 'password' } - { property: 'homepage', type: 'url' } + - { property: 'linkedin', type: 'url' } user: name_property_path: "email" \ No newline at end of file diff --git a/src/Entity/User.php b/src/Entity/User.php index cac6aafc7..533436f75 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -50,6 +50,8 @@ class User implements UserInterface */ private $homepage = ""; + private $linkedin = ""; + public function getId(): ?int { return $this->id; @@ -187,4 +189,22 @@ public function setHomepage(?string $homepage): self return $this; } + + /** + * @return string|null + */ + public function getLinkedin(): ?string + { + return $this->linkedin; + } + + /** + * @param string|null $homepage + */ + public function setLinkedin(?string $linkedin): self + { + $this->linkedin = $linkedin; + + return $this; + } } diff --git a/src/Form/RegistrationFormType.php b/src/Form/RegistrationFormType.php index 31024cd40..abd32eb31 100644 --- a/src/Form/RegistrationFormType.php +++ b/src/Form/RegistrationFormType.php @@ -36,6 +36,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ], ]) ->add('homepage', UrlType::class, ['required' => false]) + ->add('linkedin', UrlType::class, ['required' => false]) ->add('agreeTerms', CheckboxType::class, [ 'mapped' => false, 'constraints' => [ diff --git a/templates/registration/register.html.twig b/templates/registration/register.html.twig index 7206a712a..bba58fbd8 100644 --- a/templates/registration/register.html.twig +++ b/templates/registration/register.html.twig @@ -8,6 +8,7 @@ {{ form_start(registrationForm) }} {{ form_row(registrationForm.email) }} {{ form_row(registrationForm.plainPassword) }} + {{ form_row(registrationForm.linkedin) }} {{ form_row(registrationForm.homepage) }} {{ form_row(registrationForm.agreeTerms) }} diff --git a/templates/security/profile.html.twig b/templates/security/profile.html.twig index 4d6fd3f0b..35f8d46ee 100644 --- a/templates/security/profile.html.twig +++ b/templates/security/profile.html.twig @@ -11,6 +11,7 @@ {% endfor %}
Website {{ user.homepage }} + Website {{ user.linkedin }}
{% endblock %} From e2f3e073da690c344737195dbd87e630e8d37bff Mon Sep 17 00:00:00 2001 From: lukas Date: Sat, 23 Nov 2019 17:24:23 +0200 Subject: [PATCH 02/11] test2 --- src/Entity/User.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Entity/User.php b/src/Entity/User.php index 533436f75..c04fab22f 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -50,6 +50,10 @@ class User implements UserInterface */ private $homepage = ""; + /** + * @var null|string Link to Personal Website + * @ORM\Column(type="string", length=255, nullable=true) + */ private $linkedin = ""; public function getId(): ?int @@ -179,7 +183,6 @@ public function getHomepage(): ?string { return $this->homepage; } - /** * @param string|null $homepage */ @@ -197,14 +200,11 @@ public function getLinkedin(): ?string { return $this->linkedin; } - /** - * @param string|null $homepage + * @param string|null $linkedin */ - public function setLinkedin(?string $linkedin): self + public function setLinkedin(?string $linkedin): void { $this->linkedin = $linkedin; - - return $this; } } From f4a23e35f67991f0aa72f7b15c97a84ea17536cf Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 25 Nov 2019 03:44:51 +0200 Subject: [PATCH 03/11] final test --- templates/base.html.twig | 9 ++++++--- templates/security/profile.html.twig | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/templates/base.html.twig b/templates/base.html.twig index eb61ed532..7c735f505 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -32,9 +32,12 @@ - + + {% if is_granted('ROLE_ADMIN') %} + + {% endif %} {% else %} diff --git a/templates/security/profile.html.twig b/templates/security/profile.html.twig index 35f8d46ee..645881582 100644 --- a/templates/security/profile.html.twig +++ b/templates/security/profile.html.twig @@ -10,8 +10,8 @@ {{ role|lower }} {% endfor %}
- Website {{ user.homepage }} - Website {{ user.linkedin }} + Website {{ user.homepage }}
+ LinkedIn {{ user.linkedin }}
{% endblock %} From 0f0a9027a174e62b41b2ca3cc736ff17c13aaf61 Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 25 Nov 2019 03:58:59 +0200 Subject: [PATCH 04/11] migration test --- src/Migrations/Version20191123140640.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191123141018.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191123142134.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191123143342.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191123143415.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191123151138.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191123151302.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191123151409.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191123151545.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191125015622.php | 35 ++++++++++++++++++++++++ 10 files changed, 350 insertions(+) create mode 100644 src/Migrations/Version20191123140640.php create mode 100644 src/Migrations/Version20191123141018.php create mode 100644 src/Migrations/Version20191123142134.php create mode 100644 src/Migrations/Version20191123143342.php create mode 100644 src/Migrations/Version20191123143415.php create mode 100644 src/Migrations/Version20191123151138.php create mode 100644 src/Migrations/Version20191123151302.php create mode 100644 src/Migrations/Version20191123151409.php create mode 100644 src/Migrations/Version20191123151545.php create mode 100644 src/Migrations/Version20191125015622.php diff --git a/src/Migrations/Version20191123140640.php b/src/Migrations/Version20191123140640.php new file mode 100644 index 000000000..3b1575d79 --- /dev/null +++ b/src/Migrations/Version20191123140640.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Migrations/Version20191123141018.php b/src/Migrations/Version20191123141018.php new file mode 100644 index 000000000..78513829c --- /dev/null +++ b/src/Migrations/Version20191123141018.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Migrations/Version20191123142134.php b/src/Migrations/Version20191123142134.php new file mode 100644 index 000000000..7201b3c43 --- /dev/null +++ b/src/Migrations/Version20191123142134.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Migrations/Version20191123143342.php b/src/Migrations/Version20191123143342.php new file mode 100644 index 000000000..a326adae0 --- /dev/null +++ b/src/Migrations/Version20191123143342.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Migrations/Version20191123143415.php b/src/Migrations/Version20191123143415.php new file mode 100644 index 000000000..ad0e061de --- /dev/null +++ b/src/Migrations/Version20191123143415.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Migrations/Version20191123151138.php b/src/Migrations/Version20191123151138.php new file mode 100644 index 000000000..94e5a8963 --- /dev/null +++ b/src/Migrations/Version20191123151138.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Migrations/Version20191123151302.php b/src/Migrations/Version20191123151302.php new file mode 100644 index 000000000..950202f31 --- /dev/null +++ b/src/Migrations/Version20191123151302.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Migrations/Version20191123151409.php b/src/Migrations/Version20191123151409.php new file mode 100644 index 000000000..86e6ae7c5 --- /dev/null +++ b/src/Migrations/Version20191123151409.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user ADD linkedin VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user DROP linkedin, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Migrations/Version20191123151545.php b/src/Migrations/Version20191123151545.php new file mode 100644 index 000000000..b251f974c --- /dev/null +++ b/src/Migrations/Version20191123151545.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user ADD linkedin VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user DROP linkedin, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} diff --git a/src/Migrations/Version20191125015622.php b/src/Migrations/Version20191125015622.php new file mode 100644 index 000000000..dcf234e94 --- /dev/null +++ b/src/Migrations/Version20191125015622.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL, CHANGE linkedin linkedin VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci, CHANGE linkedin linkedin VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} From dab478388262632383d8dc725112774ee29bd7a4 Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 25 Nov 2019 04:11:45 +0200 Subject: [PATCH 05/11] migration test2 --- src/Migrations/Version20191125021022.php | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/Migrations/Version20191125021022.php diff --git a/src/Migrations/Version20191125021022.php b/src/Migrations/Version20191125021022.php new file mode 100644 index 000000000..8e77d198e --- /dev/null +++ b/src/Migrations/Version20191125021022.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL, CHANGE linkedin linkedin VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci, CHANGE linkedin linkedin VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} From 6f6c512f6d9053e2712f362d9741d35cf10907f2 Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 25 Nov 2019 04:15:07 +0200 Subject: [PATCH 06/11] migration test3 --- src/Migrations/Version20191116210807.php | 35 ------------------------ src/Migrations/Version20191118201725.php | 35 ------------------------ src/Migrations/Version20191118205131.php | 35 ------------------------ src/Migrations/Version20191123140640.php | 35 ------------------------ src/Migrations/Version20191123141018.php | 35 ------------------------ src/Migrations/Version20191123142134.php | 35 ------------------------ src/Migrations/Version20191123143342.php | 35 ------------------------ src/Migrations/Version20191123143415.php | 35 ------------------------ src/Migrations/Version20191123151138.php | 35 ------------------------ src/Migrations/Version20191123151302.php | 35 ------------------------ src/Migrations/Version20191123151409.php | 35 ------------------------ src/Migrations/Version20191123151545.php | 35 ------------------------ src/Migrations/Version20191125015622.php | 35 ------------------------ 13 files changed, 455 deletions(-) delete mode 100644 src/Migrations/Version20191116210807.php delete mode 100644 src/Migrations/Version20191118201725.php delete mode 100644 src/Migrations/Version20191118205131.php delete mode 100644 src/Migrations/Version20191123140640.php delete mode 100644 src/Migrations/Version20191123141018.php delete mode 100644 src/Migrations/Version20191123142134.php delete mode 100644 src/Migrations/Version20191123143342.php delete mode 100644 src/Migrations/Version20191123143415.php delete mode 100644 src/Migrations/Version20191123151138.php delete mode 100644 src/Migrations/Version20191123151302.php delete mode 100644 src/Migrations/Version20191123151409.php delete mode 100644 src/Migrations/Version20191123151545.php delete mode 100644 src/Migrations/Version20191125015622.php diff --git a/src/Migrations/Version20191116210807.php b/src/Migrations/Version20191116210807.php deleted file mode 100644 index 8795cf7bd..000000000 --- a/src/Migrations/Version20191116210807.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('DROP TABLE user'); - } -} diff --git a/src/Migrations/Version20191118201725.php b/src/Migrations/Version20191118201725.php deleted file mode 100644 index 0af21054b..000000000 --- a/src/Migrations/Version20191118201725.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user ADD homepage VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user DROP homepage, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin'); - } -} diff --git a/src/Migrations/Version20191118205131.php b/src/Migrations/Version20191118205131.php deleted file mode 100644 index 339ea2510..000000000 --- a/src/Migrations/Version20191118205131.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user ADD password_changed DATETIME DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user DROP password_changed, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191123140640.php b/src/Migrations/Version20191123140640.php deleted file mode 100644 index 3b1575d79..000000000 --- a/src/Migrations/Version20191123140640.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191123141018.php b/src/Migrations/Version20191123141018.php deleted file mode 100644 index 78513829c..000000000 --- a/src/Migrations/Version20191123141018.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191123142134.php b/src/Migrations/Version20191123142134.php deleted file mode 100644 index 7201b3c43..000000000 --- a/src/Migrations/Version20191123142134.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191123143342.php b/src/Migrations/Version20191123143342.php deleted file mode 100644 index a326adae0..000000000 --- a/src/Migrations/Version20191123143342.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191123143415.php b/src/Migrations/Version20191123143415.php deleted file mode 100644 index ad0e061de..000000000 --- a/src/Migrations/Version20191123143415.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191123151138.php b/src/Migrations/Version20191123151138.php deleted file mode 100644 index 94e5a8963..000000000 --- a/src/Migrations/Version20191123151138.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191123151302.php b/src/Migrations/Version20191123151302.php deleted file mode 100644 index 950202f31..000000000 --- a/src/Migrations/Version20191123151302.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191123151409.php b/src/Migrations/Version20191123151409.php deleted file mode 100644 index 86e6ae7c5..000000000 --- a/src/Migrations/Version20191123151409.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user ADD linkedin VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user DROP linkedin, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191123151545.php b/src/Migrations/Version20191123151545.php deleted file mode 100644 index b251f974c..000000000 --- a/src/Migrations/Version20191123151545.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user ADD linkedin VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user DROP linkedin, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} diff --git a/src/Migrations/Version20191125015622.php b/src/Migrations/Version20191125015622.php deleted file mode 100644 index dcf234e94..000000000 --- a/src/Migrations/Version20191125015622.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL, CHANGE linkedin linkedin VARCHAR(255) DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci, CHANGE linkedin linkedin VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} From c20c91cf2e1b997b7a8302b1cfcb47446e352e8e Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 25 Nov 2019 15:18:42 +0200 Subject: [PATCH 07/11] check --- src/Entity/User.php | 60 +++++-------------- ...25021022.php => Version20191118205131.php} | 6 +- 2 files changed, 19 insertions(+), 47 deletions(-) rename src/Migrations/{Version20191125021022.php => Version20191118205131.php} (58%) diff --git a/src/Entity/User.php b/src/Entity/User.php index c04fab22f..69d0cc6ab 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -1,11 +1,9 @@ id; } - public function getEmail(): ?string { return $this->email; } - public function setEmail(string $email): self { $this->email = $email; - return $this; } - /** * A visual identifier that represents this user. * @@ -82,7 +69,6 @@ public function getUsername(): string { return (string)$this->email; } - /** * @see UserInterface */ @@ -91,35 +77,28 @@ public function getRoles(): array $roles = $this->roles; // guarantee every user at least has ROLE_USER $roles[] = 'ROLE_USER'; - return array_unique($roles); } - public function setRoles(array $roles): self { $this->roles = $roles; - return $this; } - /** Virtual method for EasyAdminBundle */ public function getPlainPassword(): string { return ''; // We store passwords hashed, it is impossible to regenerate back } - - /** Virtual method for EasyAdminBundle */ + /** Virtual metFixedhod for EasyAdminBundle */ public function setPlainPassword($password): self { if (!$password) { return $this; // For usability: Empty password means do not change password } - $this->passwordWasChanged = true; $hash = password_hash($password, PASSWORD_ARGON2I); return $this->setPassword($hash); } - /** * @return bool */ @@ -127,22 +106,18 @@ public function isPasswordWasChanged(): bool { return $this->passwordWasChanged; } - /** * @see UserInterface */ public function getPassword(): string { - return (string) $this->password; + return (string)$this->password; } - public function setPassword(string $password): self { $this->password = $password; - return $this; } - /** * @see UserInterface */ @@ -150,7 +125,6 @@ public function getSalt() { // not needed when using the "bcrypt" algorithm in security.yaml } - /** * @see UserInterface */ @@ -159,23 +133,20 @@ public function eraseCredentials() // If you store any temporary, sensitive data on the user, clear it here // $this->plainPassword = null; } - /** - * @return \DateTime|null + * @return DateTime|null */ - public function getPasswordChanged(): ?\DateTime + public function getPasswordChanged(): ?DateTime { return $this->passwordChanged; } - /** - * @param \DateTime|null $passwordChanged + * @param DateTime|null $passwordChanged */ - public function setPasswordChanged(?\DateTime $passwordChanged): void + public function setPasswordChanged(?DateTime $passwordChanged): void { $this->passwordChanged = $passwordChanged; } - /** * @return string|null */ @@ -185,26 +156,27 @@ public function getHomepage(): ?string } /** * @param string|null $homepage + * @return User */ public function setHomepage(?string $homepage): self { - $this->homepage = $homepage; - + $this->homepage = $homepage;id return $this; } - /** * @return string|null */ - public function getLinkedin(): ?string + public function getLinkedIn(): ?string { return $this->linkedin; } /** * @param string|null $linkedin + * @return User */ - public function setLinkedin(?string $linkedin): void + public function setLinkedIn(?string $linkedin): self { $this->linkedin = $linkedin; + return $this; } -} +} \ No newline at end of file diff --git a/src/Migrations/Version20191125021022.php b/src/Migrations/Version20191118205131.php similarity index 58% rename from src/Migrations/Version20191125021022.php rename to src/Migrations/Version20191118205131.php index 8e77d198e..339ea2510 100644 --- a/src/Migrations/Version20191125021022.php +++ b/src/Migrations/Version20191118205131.php @@ -10,7 +10,7 @@ /** * Auto-generated Migration: Please modify to your needs! */ -final class Version20191125021022 extends AbstractMigration +final class Version20191118205131 extends AbstractMigration { public function getDescription() : string { @@ -22,7 +22,7 @@ public function up(Schema $schema) : void // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL, CHANGE linkedin linkedin VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE user ADD password_changed DATETIME DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL'); } public function down(Schema $schema) : void @@ -30,6 +30,6 @@ public function down(Schema $schema) : void // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - $this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci, CHANGE linkedin linkedin VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + $this->addSql('ALTER TABLE user DROP password_changed, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); } } From 7f663d84e7f1d7081e253c81450520a332b7dd5e Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 25 Nov 2019 15:21:47 +0200 Subject: [PATCH 08/11] check2 --- src/Migrations/Version20191116210807.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191118201725.php | 35 ++++++++++++++++++++++++ src/Migrations/Version20191125131043.php | 35 ++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 src/Migrations/Version20191116210807.php create mode 100644 src/Migrations/Version20191118201725.php create mode 100644 src/Migrations/Version20191125131043.php diff --git a/src/Migrations/Version20191116210807.php b/src/Migrations/Version20191116210807.php new file mode 100644 index 000000000..8795cf7bd --- /dev/null +++ b/src/Migrations/Version20191116210807.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('DROP TABLE user'); + } +} diff --git a/src/Migrations/Version20191118201725.php b/src/Migrations/Version20191118201725.php new file mode 100644 index 000000000..0af21054b --- /dev/null +++ b/src/Migrations/Version20191118201725.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user ADD homepage VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user DROP homepage, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin'); + } +} diff --git a/src/Migrations/Version20191125131043.php b/src/Migrations/Version20191125131043.php new file mode 100644 index 000000000..d217bbefd --- /dev/null +++ b/src/Migrations/Version20191125131043.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user ADD linked_in VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user DROP linked_in, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +} From 043a2de14ff99b89c98bc9f11a9914c71ad1aff5 Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 25 Nov 2019 15:26:30 +0200 Subject: [PATCH 09/11] fix --- src/Entity/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entity/User.php b/src/Entity/User.php index 69d0cc6ab..2a3b4df1e 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -160,7 +160,7 @@ public function getHomepage(): ?string */ public function setHomepage(?string $homepage): self { - $this->homepage = $homepage;id + $this->homepage = $homepage; return $this; } /** From a19d30134219146641ea0723f9a4ab4378521bd3 Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 25 Nov 2019 15:35:14 +0200 Subject: [PATCH 10/11] fix2 --- src/Entity/User.php | 4 +-- src/Migrations/Version20191125131043.php | 35 ------------------------ 2 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 src/Migrations/Version20191125131043.php diff --git a/src/Entity/User.php b/src/Entity/User.php index 2a3b4df1e..329a145fe 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -166,7 +166,7 @@ public function setHomepage(?string $homepage): self /** * @return string|null */ - public function getLinkedIn(): ?string + public function getLinkedin(): ?string { return $this->linkedin; } @@ -174,7 +174,7 @@ public function getLinkedIn(): ?string * @param string|null $linkedin * @return User */ - public function setLinkedIn(?string $linkedin): self + public function setLinkedin(?string $linkedin): self { $this->linkedin = $linkedin; return $this; diff --git a/src/Migrations/Version20191125131043.php b/src/Migrations/Version20191125131043.php deleted file mode 100644 index d217bbefd..000000000 --- a/src/Migrations/Version20191125131043.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user ADD linked_in VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); - } - - public function down(Schema $schema) : void - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); - - $this->addSql('ALTER TABLE user DROP linked_in, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); - } -} From 4a4069c1be5f53b0822f9ca2eaca476e3fc973de Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 25 Nov 2019 15:35:41 +0200 Subject: [PATCH 11/11] fix3 --- src/Migrations/Version20191125133334.php | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/Migrations/Version20191125133334.php diff --git a/src/Migrations/Version20191125133334.php b/src/Migrations/Version20191125133334.php new file mode 100644 index 000000000..531a04de4 --- /dev/null +++ b/src/Migrations/Version20191125133334.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user ADD linkedin VARCHAR(255) DEFAULT NULL, CHANGE roles roles JSON NOT NULL, CHANGE homepage homepage VARCHAR(255) DEFAULT NULL, CHANGE password_changed password_changed DATETIME DEFAULT NULL'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE user DROP linkedin, CHANGE roles roles LONGTEXT NOT NULL COLLATE utf8mb4_bin, CHANGE password_changed password_changed DATETIME DEFAULT \'NULL\', CHANGE homepage homepage VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci'); + } +}