mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
person: add url field to SocialWork Evaluation entity + populate with http title values
This commit is contained in:
parent
d50d68aa86
commit
349db2142d
@ -62,6 +62,12 @@ class Evaluation
|
||||
*/
|
||||
private array $title = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?string $url = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->socialActions = new ArrayCollection();
|
||||
@ -101,6 +107,11 @@ class Evaluation
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function getUrl(): ?string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function removeSocialAction(SocialAction $socialAction): self
|
||||
{
|
||||
if ($this->socialActions->contains($socialAction)) {
|
||||
@ -130,4 +141,11 @@ class Evaluation
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUrl(?string $url): self
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add url to SocialWork Evaluation
|
||||
*/
|
||||
final class Version20220303113855 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add url to SocialWork Evaluation';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ADD url TEXT DEFAULT NULL');
|
||||
$this->addSql("UPDATE chill_person_social_work_evaluation SET url = CASE WHEN title->>'fr' LIKE 'http%' THEN title->>'fr' ELSE null END;");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation DROP url');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user