/** * Add a store to the database * * @param string $storeId 32-character long store id * @param string $storeLocation URL to obtain the store info * @param string $storeType type of store (only "license" supported now) * @param string $storeVersion version of the data store */ public static function addStore($storeId, $storeLocation, $storeType = "license", $storeVersion = STORE_VERSION) { $store = new AddonsStore(); $store->setStoreId($storeId); $store->setStoreLocation($storeLocation); $store->setStoreVersion($storeVersion); $store->setStoreType($storeType); return AddonsStorePeer::doInsert($store); }
/** * Stores the object in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param Connection $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave($con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // If this object has been modified, then save it to the database. if ($this->isModified()) { if ($this->isNew()) { $pk = AddonsStorePeer::doInsert($this, $con); $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which // should always be true here (even though technically // BasePeer::doInsert() can insert multiple rows). $this->setNew(false); } else { $affectedRows += AddonsStorePeer::doUpdate($this, $con); } $this->resetModified(); // [HL] After being saved an object is no longer 'modified' } $this->alreadyInSave = false; } return $affectedRows; }