/** * (non-PHPdoc) * @see Lampcms\Interfaces.CommentedResource::addComment() */ public function addComment(CommentParser $Comment) { $aKeys = array('_id', 'i_uid', 'i_prnt', 'username', 'avtr', 'b_owner', 'inreplyto', 's_inreply', 'b', 't', 'ts', 'cc', 'cn', 'reg', 'city', 'zip', 'lat', 'lon'); $aComments = $this->getComments(); d('aComments: ' . print_r($aComments, 1)); /** * Only keep the keys that we need * get rid of keys like hash, i_res * because we don't need them here */ $aComment = $Comment->getArrayCopy(); $aComment = array_intersect_key($aComment, array_flip($aKeys)); $aComments[] = $aComment; $this->setComments($aComments); /** * A commentor on the question * is considered a question contributor, * so we must add contributor now */ $this->addContributor($aComment['i_uid']); return $this; }
/** * Registers the comment parser */ protected function handleComments() { $parser = new CommentParser(); $parser->register(); }