private function SaveWithParameters($post, $entityName) { $success = false; $result = Database::Save(null, $post, $entityName); echo $result; if (isset($result) && !empty($result)) { $this->_entity = $result['entity']; $this->_id = $result['entity_id']; if (isset($this->_entity) && isset($this->_id)) { $success = true; echo $success; } } return $success; }
public function Save($post) { $success = false; // Keeping the apiary_id in memory before sending data to the parent method $apiary_id = $post['apiary_id']; unset($post['apiary_id']); $success = parent::Save($post, 'beehive'); if ($this->_id != null) { $apiary = ApiaryRepository::FindById($apiary_id); $apiary->ownBeehive[] = $this->_entity; //TODO: See what we do with saving functionalities //$saved_apiary_id = ApiaryFactory::Save($apiary); $saved_apiary_id = Database::Save($apiary); if (isset($this->_id) && isset($saved_apiary_id)) { $success = true; } } return $success; }
public function SetOutgoingIP() { $ips = Database::Find(parent::_DB_IPS_TABLE, array('order' => array('usage_count'))); $this->_outgoingIP = $ips[0]['ip']; Database::Save(parent::_DB_IPS_TABLE, array('id' => $ips[0]['id'], 'usage_count' => ++$ips[0]['usage_count'])); }