data['wikitext'])) { throw new InvalidPostDataException('wikitext', $this->data); } //create row in wiki.pages $page = new WikiPage(); $fields = WikiPage::getFields($vendor); foreach ($this->data as $key => $value) { if (!isset($fields[$key])) { continue; } settype($value, $fields[$key]['type']); $page->$key = $value; } $page->created_user_id = 1; $page->category_id = 1; $pageId = $page->insert($vendor); //create first revision in wiki.history $history = new WikiHistory(); WikiHistory::getFields($vendor); $history->page_id = $pageId; $history->revision = 1; $history->wikitext = $this->data['wikitext']; $history->created_user_id = 1; return $history->insert($vendor); } } ?>