/** * Create a new section * * @param string $name * @param string $identifier * * @return \eZ\Publish\SPI\Persistence\Content\Section */ public function create($name, $identifier) { $section = new Section(); $section->name = $name; $section->identifier = $identifier; $section->id = $this->sectionGateway->insertSection($name, $identifier); return $section; }
/** * Inserts a new section with $name and $identifier. * * @param string $name * @param string $identifier * * @return int The ID of the new section */ public function insertSection($name, $identifier) { try { return $this->innerGateway->insertSection($name, $identifier); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }