storedObject: add title field on StoredObject entity

This commit is contained in:
nobohan 2022-05-25 16:32:52 +02:00
parent 5948ac5b2a
commit dea554ced4
2 changed files with 54 additions and 0 deletions

View File

@ -71,6 +71,12 @@ class StoredObject implements AsyncFileInterface, Document
*/
private array $keyInfos = [];
/**
* @ORM\Column(type="text", name="title")
* @Serializer\Groups({"read", "write"})
*/
private string $title = '';
/**
* @ORM\Column(type="text", name="type")
* @Serializer\Groups({"read", "write"})
@ -127,6 +133,11 @@ class StoredObject implements AsyncFileInterface, Document
return $this->getFilename();
}
public function getTitle()
{
return $this->title;
}
public function getType()
{
return $this->type;
@ -177,6 +188,13 @@ class StoredObject implements AsyncFileInterface, Document
return $this;
}
public function setTitle(?string $title)
{
$this->title = (string) $title;
return $this;
}
public function setType(?string $type)
{
$this->type = (string) $type;

View File

@ -0,0 +1,36 @@
<?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\DocStore;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add title on storedObject
*/
final class Version20220525141646 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add title on storedObject';
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_doc.stored_object DROP title');
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_doc.stored_object ADD title TEXT NOT NULL DEFAULT \'\' ');
}
}