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..da9e8f7c9 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -49,6 +49,28 @@ class User implements UserInterface * @ORM\Column(type="string", length=255, nullable=true) */ private $homepage = ""; + /** + * @var null|string + * @ORM\Column(type="string", length=255, nullable=true) + */ + private $linkedin; + + /** + * @return string|null + */ + public function getLinkedin(): ?string + { + return $this->linkedin; + } + + /** + * @param string|null $linkedin + */ + public function setLinkedin(?string $linkedin): void + { + $this->linkedin = $linkedin; + } + public function getId(): ?int { 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/src/Migrations/Version20191126200240.php b/src/Migrations/Version20191126200240.php new file mode 100644 index 000000000..86e70f365 --- /dev/null +++ b/src/Migrations/Version20191126200240.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'); + } +} diff --git a/src/Migrations/Version20191126205244.php b/src/Migrations/Version20191126205244.php new file mode 100644 index 000000000..3ffcd8b3d --- /dev/null +++ b/src/Migrations/Version20191126205244.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, DROP linked_in, 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 ADD linked_in VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8mb4_unicode_ci, 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/templates/base.html.twig b/templates/base.html.twig index eb61ed532..272cddca5 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -32,9 +32,12 @@