Merge "Updated Presentation Entity"

This commit is contained in:
Zuul 2021-04-29 16:24:25 +00:00 committed by Gerrit Code Review
commit b22c810fa3
4 changed files with 80 additions and 0 deletions

View File

@ -324,6 +324,7 @@ final class OAuth2PresentationApiController extends OAuth2ProtectedController
'type_id' => 'required|integer',
'track_id' => 'required|integer',
'attending_media' => 'required|boolean',
'will_all_speakers_attend' => 'sometimes|boolean',
'links' => 'sometimes|url_array',
'extra_questions' => 'sometimes|entity_value_array',
'tags' => 'sometimes|string_array',
@ -391,6 +392,7 @@ final class OAuth2PresentationApiController extends OAuth2ProtectedController
'description' => 'required|string|max:1100',
'social_description' => 'required|string|max:110',
'attendees_expected_learnt' => 'required|string|max:1100',
'will_all_speakers_attend' => 'sometimes|boolean',
'type_id' => 'required|integer',
'track_id' => 'required|integer',
'attending_media' => 'required|boolean',

View File

@ -123,6 +123,12 @@ class Presentation extends SummitEvent
*/
protected $attending_media;
/**
* @ORM\Column(name="WillAllSpeakersAttend", type="boolean")
* @var bool
*/
protected $will_all_speakers_attend;
/**
* @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="moderated_presentations", fetch="EXTRA_LAZY")
* @ORM\JoinColumn(name="ModeratorID", referencedColumnName="ID", onDelete="SET NULL")
@ -241,6 +247,7 @@ class Presentation extends SummitEvent
$this->actions = new ArrayCollection();
$this->to_record = false;
$this->attending_media = false;
$this->will_all_speakers_attend = false;
}
/**
@ -1527,4 +1534,21 @@ class Presentation extends SummitEvent
usort($array, [ $this , 'actionSort' ]);
return $array;
}
/**
* @return bool
*/
public function isWillAllSpeakersAttend(): bool
{
return $this->will_all_speakers_attend;
}
/**
* @param bool $will_all_speakers_attend
*/
public function setWillAllSpeakersAttend(bool $will_all_speakers_attend): void
{
$this->will_all_speakers_attend = $will_all_speakers_attend;
}
}

View File

@ -462,6 +462,9 @@ final class PresentationService
if (isset($data['description']))
$presentation->setAbstract(html_entity_decode(trim($data['description'])));
if (isset($data['will_all_speakers_attend']))
$presentation->setWillAllSpeakersAttend(boolval($data['will_all_speakers_attend']));
if (isset($data['social_description']))
$presentation->setSocialSummary(strip_tags(trim($data['social_description'])));

View File

@ -0,0 +1,51 @@
<?php namespace Database\Migrations\Model;
/**
* Copyright 2021 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema as Schema;
use LaravelDoctrine\Migrations\Schema\Builder;
use LaravelDoctrine\Migrations\Schema\Table;
/**
* Class Version20210429160901
* @package Database\Migrations\Model
*/
class Version20210429160901 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema):void
{
$builder = new Builder($schema);
if($schema->hasTable("Presentation")) {
$builder->table('Presentation', function (Table $table) {
$table->boolean("will_all_speakers_attend")->setDefault(false)->setNotnull(true);
});
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema):void
{
$builder = new Builder($schema);
if($schema->hasTable("Presentation")) {
$builder->table('Presentation', function (Table $table) {
$table->dropColumn("will_all_speakers_attend");
});
}
}
}