db = $db; $this->pageId = $pageId; } public function getUnits(): array { $res = $this->db->select( self::TABLE, [ 'trs_key', 'trs_text' ], [ 'trs_page' => $this->pageId ], __METHOD__ ); $units = []; foreach ( $res as $row ) { $units[$row->trs_key] = new TranslationUnit( $row->trs_text, $row->trs_key ); } return $units; } /** @return string[] */ public function getNames(): array { return $this->db->selectFieldValues( self::TABLE, 'trs_key', [ 'trs_page' => $this->pageId ], __METHOD__ ); } public function delete(): void { $this->db->delete( self::TABLE, [ 'trs_page' => $this->pageId ], __METHOD__ ); } }