/** * * * @param mixed $pm_element_code_or_id * @param array $pa_options * * * @return int Number of attributes attached to the current row for the specified metadata element */ public function getAttributeCountByElement($pm_element_code_or_id, $pa_options = null) { if (!($vn_row_id = $this->getPrimaryKey())) { if (isset($pa_options['row_id']) && $pa_options['row_id']) { $vn_row_id = $pa_options['row_id']; } else { return null; } } $vn_element_id = $this->_getElementID($pm_element_code_or_id); return ca_attributes::getAttributeCount($this->getDb(), $this->tableNum(), $vn_row_id, $vn_element_id); }
public function testGetAttributeCount() { $t_element = ca_attributes::getElementInstance('internal_notes'); $this->opt_object->getDb()->dieOnError(true); $this->assertEquals(2, ca_attributes::getAttributeCount($this->opt_object->getDb(), $this->opt_object->tableNum(), $this->opt_object->getPrimaryKey(), $t_element->getPrimaryKey())); }