Example #1
0
 public function create(Page $page)
 {
     $this->pdo->beginTransaction();
     try {
         $this->objectRepository->create(Page::TYPE, $page->getUuid());
         $this->executeSql('
             INSERT INTO pages (page_uuid, title, slug, short_title, parent_uuid, sort_order, status)
                  VALUES (:page_uuid, :title, :slug, :short_title, :parent_uuid, :sort_order, :status)
         ', ['page_uuid' => $page->getUuid()->getBytes(), 'title' => $page->getTitle(), 'slug' => $page->getSlug(), 'short_title' => $page->getShortTitle(), 'parent_uuid' => $page->getParentUuid() ? $page->getParentUuid()->getBytes() : null, 'sort_order' => $page->getSortOrder(), 'status' => $page->getStatus()->toString()]);
         $this->pdo->commit();
         $page->metaDataSetInsertTimestamp(new \DateTimeImmutable());
     } catch (\Throwable $exception) {
         $this->pdo->rollBack();
         throw $exception;
     }
 }