Initial survey bundle import
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mummert\SurveyBundle\Form\Model;
|
||||
|
||||
use Mummert\SurveyBundle\Model\SurveyModel;
|
||||
|
||||
final class SurveyEditorData
|
||||
{
|
||||
public string $title = '';
|
||||
public string $description = '';
|
||||
public bool $published = false;
|
||||
|
||||
public static function fromModel(SurveyModel $survey): self
|
||||
{
|
||||
$data = new self();
|
||||
$data->title = (string) $survey->title;
|
||||
$data->description = (string) $survey->description;
|
||||
$data->published = '1' === (string) $survey->published;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'published' => $this->published,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user