public function saveAttribute(JosAttribute $attribute) { $data = array('attribute_code' => $attribute->getAttributeCode(), 'year_id' => $attribute->getYearId(), 'frontend_input' => $attribute->getFrontendInput(), 'frontend_label' => $attribute->getFrontendLabel(), 'value_table' => $attribute->getValueTable()); $attribute_id = (int) $attribute->getAttributeId(); if ($attribute_id == 0) { $this->tableGateway->insert($data); } else { if ($this->getAttributeByArrayConditionAndArrayColumn(array('attribute_id' => $attribute_id), array('attribute_code'))) { $this->tableGateway->update($data, array('attribute_id' => $attribute_id)); } else { return false; } } return true; }