/** * Add new exporter item to this exporter. * @param int $pn_parent_id parent id for the new record. can be null * @param string $ps_element name of the target element * @param string $ps_source value for 'source' field. this will typicall be a bundle name * @param array $pa_settings array of user settings * @return ca_data_exporter_items BaseModel representation of the new record */ public function addItem($pn_parent_id = null, $ps_element, $ps_source, $pa_settings = array()) { if (!($vn_exporter_id = $this->getPrimaryKey())) { return null; } $t_item = new ca_data_exporter_items(); $t_item->setMode(ACCESS_WRITE); $t_item->set('parent_id', $pn_parent_id); $t_item->set('exporter_id', $vn_exporter_id); $t_item->set('element', $ps_element); $t_item->set('source', $ps_source); foreach ($pa_settings as $vs_key => $vs_value) { $t_item->setSetting($vs_key, $vs_value); } $t_item->insert(); if ($t_item->numErrors()) { $this->errors = array_merge($this->errors, $t_item->errors); return false; } return $t_item; }