3 Commits

4 changed files with 3 additions and 33 deletions
-2
View File
@@ -273,8 +273,6 @@ class Game
$v->save($this->getEntityManager());
}
$v->setTwigSceneRenderer($this->getSceneRenderer());
return $v;
}
-13
View File
@@ -11,8 +11,6 @@ use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\OneToOne;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Mapping\PostLoad;
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
use LotGD\Core\Action;
use LotGD\Core\ActionGroup;
@@ -30,7 +28,6 @@ use LotGD\Core\Tools\SceneDescription;
* all changes from modules included.
* @Entity
* @Table(name="viewpoints")
* @HasLifecycleCallbacks
*/
class Viewpoint implements CreateableInterface
{
@@ -72,16 +69,6 @@ class Viewpoint implements CreateableInterface
"owner",
];
/**
* @PostLoad
*/
public function onLoad()
{
foreach ($this->actionGroups as $actionGroup) {
$actionGroup->setViewpoint($this);
}
}
/**
* Returns the owner.
* @return Character
+3 -16
View File
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace LotGD\Core\Services;
use Doctrine\DBAL\Exception as DBALException;
use LotGD\Core\Action;
use LotGD\Core\Events\EventContextData;
use LotGD\Core\Exceptions\CharacterNotFoundException;
@@ -36,14 +35,8 @@ class TwigSceneRenderer
// the viewpoint itself.
$eventManager = $this->game->getEventManager();
$contextData = EventContextData::create(["templateValues" => []]);
// Use try-catch here in case no database has yet been created. See #162
try {
$newContextData = $eventManager->publish("h/lotgd/core/scene-renderer/templateValues", $contextData);
$this->templateValues = $newContextData->get("templateValues") ?? [];
} catch (DBALException) {
$this->templateValues = [];
}
$newContextData = $eventManager->publish("h/lotgd/core/scene-renderer/templateValues", $contextData);
$this->templateValues = $newContextData->get("templateValues") ?? [];
// Add Sandbox extension
$securityPolicy = $this->getSecurityPolicy();
@@ -132,13 +125,7 @@ class TwigSceneRenderer
"methods" => $methods,
"properties" => $properties,
]);
// Use try-catch here in case no database has yet been created. See #162
try {
$newContextData = $eventManager->publish("h/lotgd/core/scene-renderer/securityPolicy", $contextData);
} catch (DBALException) {
$this->templateValues = [];
}
$newContextData = $eventManager->publish("h/lotgd/core/scene-renderer/securityPolicy", $contextData);
// Set changed values from the event.
$tags = $newContextData->get("tags");
-2
View File
@@ -126,8 +126,6 @@ class ViewpointTest extends CoreModelTestCase
$this->assertSame($should->getTitle(), $is->getTitle());
$this->assertSame($should->getSortKey(), $is->getSortKey());
$this->assertSame(count($should->getActions()), count($is->getActions()));
$this->assertSame($output, $is->getViewpoint());
}
$this->assertEquals($ag2->getTitle(), $input->findActionGroupById('id2')->getTitle());