function createUser($username, $password, $role) { $i = Persistence::getInstance(); $collection = 'users'; $document = array('name' => $username, 'password' => $password, 'type' => $role); return $i->insertDocument($document, $collection); }
public function invoke() { $p = Persistence::getInstance(); $_model = $this->get_called_class(); $params = $this->getArray(); $resp = $p->invoke($_model, $params); $arrayo = array(); if ($resp) { foreach ($resp as $array) { array_push($arrayo, $array); } } return $arrayo; }
public function insertar($_name, $_address, $_city, $_province, $_email, $_country, $_shippingMethod, $_paymentMethod, $_zipCode, $_phone) { $instance = Persistence::getInstance(); $arregloCabeza = array("price" => $this->_price); $arregloCuerpo = array("productos" => $this->_productos); $name = array('name' => $_name); $address = array('address' => $_address); $city = array('city' => $_city); $province = array('city' => $_province); $email = array('email' => $_email); $country = array('country' => $_country); $shippingMethod = array('shippingMethod' => $_shippingMethod); $paymentMethod = array('paymentMethod' => $_paymentMethod); $zipCode = array('zipCode' => $_zipCode); $phone = array('phone' => $_phone); $arregloFinal = array_merge($arregloCabeza, $arregloCuerpo, $name, $address, $city, $province, $email, $country, $shippingMethod, $paymentMethod, $zipCode, $phone); $instance->insertDocument($arregloFinal, 'orders'); }
public function get() { $user = Session::get_user(); $p = Persistence::getInstance(); $_model = $this->model->get_called_class(); $array = $this->filter; if ($this->model instanceof User) { $_packa = null; $array['hashtype'] = $this->model->getHashType()->val(); } else { $_packa = $this->model->get_package(); } $resp = $p->filter($user, $_packa, strtolower($_model), $array); $arrayo = array(); $class = get_class($this->model); if ($resp) { foreach ($resp as $array) { $object = new $class(); $object->setArray($array); array_push($arrayo, $object); } } return $arrayo; }
public function autenticate() { $p = Persistence::getInstance(); return $p->autenticate($this); }
try { $this->_conexion = new Mongo(); } catch (Exception $e) { error_log($e->getMessage(), 3, '../log/Error.log'); } self::insertImagen(); } public function getAll($collection) { $db = $this->_conexion->shoppingCart; $collection = $db->{$collection}; $cursor = $collection->find(); $arreglo = array(); foreach ($cursor as $obj) { $arreglo[] = $obj; } return $arreglo; } function deleteDocument($id, $collec) { $db = $this->_conexion->shoppingCart; $collection = $db->{$collec}; if ($collection->remove(array('_id' => new MongoId($id)), true)) { return true; } else { return false; } } } Persistence::getInstance();
function delete($id) { $i = Persistence::getInstance(); $collection = 'products'; return $i->deleteDocument($id, $collection); }
public function delete() { $p = Persistence::getInstance(); $user = Session::get_user(); return $p->delete($user, $this->get_package(), $this->get_called_class(), $this->getArray()); }