diff --git a/config/packages/easy_admin.yaml b/config/packages/easy_admin.yaml index a34b62ecb..b4cc3170f 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..79207915f 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -50,6 +50,12 @@ class User implements UserInterface */ private $homepage = ""; + /** + * @var null|string Link to LinkedIn Profile + * @ORM\Column(type="string", length=255, nullable=true) + */ + private $linkedIn = ""; + public function getId(): ?int { return $this->id; @@ -187,4 +193,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..fd0da7fe1 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/Version20191126202105.php b/src/Migrations/Version20191126202105.php new file mode 100644 index 000000000..19dbc7df2 --- /dev/null +++ b/src/Migrations/Version20191126202105.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/templates/base.html.twig b/templates/base.html.twig index eb61ed532..9f8fc70e2 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -32,10 +32,11 @@