Ejemplo n.º 1
0
 public function __construct($settings)
 {
     parent::bootstrap();
     $t = microtime(true);
     $redis = new \Redis();
     try {
         $redis->connect($settings['host'], $settings['port']);
         if (isset($settings['password']) && !empty($settings['password'])) {
             if ($redis->auth($settings['password']) === false) {
                 throw new \Exception('Unable to authenticate with redis!');
             }
         }
         if (isset($settings['database']) && !empty($settings['database'])) {
             if ($redis->select($settings['database']) === false) {
                 throw new \Exception('Unable to Redis database select');
             }
         }
     } catch (\Exception $e) {
         throw new \Exception('Unable to connect to Redis server');
     }
     if (isset($settings['prefix'])) {
         $redis->setOption(\Redis::OPT_PREFIX, $settings['prefix'] . ':');
     }
     parent::$serviceInstance[get_class()] = $redis;
     $queryTime = round((microtime(true) - $t) * 1000, 2);
     self::logQuery(array('command' => 'CONNECTION to ' . $settings['host'] . ':' . $settings['port'], 'time' => $queryTime));
     self::$_totalTime[get_class()] += $queryTime;
     self::$_totalQueries[get_class()]++;
 }
Ejemplo n.º 2
0
 public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
 {
     parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
     if (null === $baseApiUri) {
         $this->baseApiUri = new Uri('http://rest.bullhorn.com/rest-services/');
     }
 }
Ejemplo n.º 3
0
 /**
  * Adds the start and limit parameters to each request.
  *
  * {@inheritDoc}
  */
 protected function createUrl($path, array $params = array())
 {
     $params = array_merge(array('startAt' => $this->start, 'maxResults' => $this->limit), $params);
     if ($this->fields) {
         $params['fields'] = $this->fields;
     }
     $url = parent::createUrl($path, $params);
     return $url;
 }
 public function insert(array $data, $entity)
 {
     $data['dta_inc'] = true;
     if (isset($data['comentarioId']) && $data['comentarioId'] > 0) {
         $data['comentario'] = $this->getEmRef('Admin\\Entity\\Comentario', $data['comentarioId']);
     }
     $data['post'] = $this->getEmRef('Admin\\Entity\\Post', $data['postId']);
     return parent::insert($data, $entity);
 }
Ejemplo n.º 5
0
 public function getModel($construct = null)
 {
     $model = parent::getModel($construct);
     if (is_array($construct) && isset($construct['parent_product_id'])) {
         $optionService = $this->getOptionService();
         $options = $optionService->getByProductId($construct['parent_product_id'], array('choices'), true, array('builder' => 1));
         $model->setOptions($options);
     }
     return $model;
 }
Ejemplo n.º 6
0
 public function update(array $data, $id, $entity = null)
 {
     // verificando a categoria
     if ($data['perfil'] > 0) {
         $data['perfil'] = $this->getEmRef('Admin\\Entity\\Perfil', $data['perfil']);
     } else {
         unset($data['perfil']);
     }
     parent::update($data, $id);
 }
 public function save(array $data = [])
 {
     /* Setando o proprietário do usuário */
     $data['owner'] = $this->entityManager->getReference("Application\\Entity\\WcUser", $this->getUserLogged()->getId());
     /* setando o idioma do usuário */
     if (isset($data['language']) && $data['language'] != '') {
         $data['language'] = $this->entityManager->getReference("Application\\Entity\\WcLanguage", $data['language']);
     }
     return parent::save($data);
 }
Ejemplo n.º 8
0
 public function update($model)
 {
     if ($model->isMain) {
         $pdo = PDOBuilder::getPDO();
         $db = DB::get();
         $stmt = $pdo->prepare("UPDATE CURRENCIES SET MAIN = " . $db->false());
         $stmt->execute();
     }
     return parent::update($model);
 }
Ejemplo n.º 9
0
 public function update(array $data, $id, $entity = null)
 {
     //$data['slug'] = $this->titleToSlug($data['nome']);
     // verificando a categoria
     if ($data['categoria'] > 0) {
         $data['categoria'] = $this->getEmRef('Admin\\Entity\\Categoria', $data['categoria']);
     } else {
         unset($data['categoria']);
     }
     parent::update($data, $id);
 }
Ejemplo n.º 10
0
 public function update(array $data, $id, $entity = null)
 {
     // se a senha estiver vazia é porque não foi alterada e destroy o campo
     if (empty($data['senha'])) {
         unset($data['senha']);
     } else {
         $data['token'] = $this->getToken();
     }
     // verificando a categoria
     $data['perfil'] = $this->getEmRef('Admin\\Entity\\Perfil', $data['perfil']);
     parent::update($data, $id);
 }
 public function update(array $data, $id, $entity = null)
 {
     $caracteristicas = array();
     if (count($data['caracteristica'])) {
         foreach ($data['caracteristica'] as $caracteristica) {
             $caracteristicas[] = $this->getEmRef('Admin\\Entity\\Caracteristica', $caracteristica);
         }
         $data['caracteristica'] = $caracteristicas;
     } else {
         unset($data['caracteristica']);
     }
     parent::update($data, $id);
 }
Ejemplo n.º 12
0
 public function __construct($settings)
 {
     parent::bootstrap();
     $t = microtime(true);
     try {
         parent::$serviceInstance[get_class()] = new \Mongo($settings['host'] . ':' . $settings['port']);
     } catch (\Exception $e) {
         throw new \Exception('Unable to connect to Mongo server');
     }
     $queryTime = round((microtime(true) - $t) * 1000, 2);
     parent::logQuery(array('command' => 'CONNECTION to ' . $settings['host'] . ':' . $settings['port'], 'time' => $queryTime));
     parent::$_totalTime[get_class()] += $queryTime;
     parent::$_totalQueries[get_class()]++;
 }
Ejemplo n.º 13
0
 public function insert(array $data, $entity = null)
 {
     $em = $this->getEm();
     $entity = $entity ?: $this->entity;
     $data['estoque'] = $this->getEmRef('Admin\\Entity\\Estoque', $data['estoque']);
     $data['dta_inc'] = true;
     $data['dta_upd'] = true;
     $em->getConnection()->beginTransaction();
     try {
         $dataEstoqueLog = parent::insert($data);
         if ($entityEstoque = $dataEstoqueLog->getEstoque()) {
             switch ($dataEstoqueLog->getTipo()) {
                 case "1":
                 case "4":
                     $qtd = $entityEstoque->getQtd() + $dataEstoqueLog->getQtd();
                     $entityEstoque->setQtd($qtd);
                     $entityEstoque->setDtaUpd(true);
                     break;
                 case "2":
                 case "3":
                     $qtd = $entityEstoque->getQtd() - $dataEstoqueLog->getQtd();
                     $entityEstoque->setQtd($qtd);
                     $entityEstoque->setDtaUpd(true);
                     break;
             }
             $em->persist($entityEstoque);
             $em->flush();
             $em->getConnection()->commit();
             return $entityEstoque;
         }
     } catch (\Exception $e) {
         $em->getConnection()->rollback();
         $em->close();
         return false;
     }
 }
Ejemplo n.º 14
0
 /**
  * Build default config for client
  * 
  * This overrides the default base-url by adding the instance-specific
  * acctPid and feedPid
  * 
  * @return array
  */
 protected function buildClientDefaultConfig()
 {
     $options = parent::buildClientDefaultConfig();
     $options['base_uri'] = implode('/', [rtrim(static::$baseUrl, '/'), $this->accountPid, $this->feedPid]);
     return $options;
 }
Ejemplo n.º 15
0
 public function insert($dataOrModel)
 {
     $vars = array('data' => $dataOrModel);
     $this->getEventManager()->trigger('insert.pre', $this, $vars);
     $id = parent::insert($dataOrModel);
     $vars['result'] = $id;
     $this->getEventManager()->trigger('insert.post', $this, $vars);
     return $this->find(array('product_id' => $id));
 }
Ejemplo n.º 16
0
 public function insert(array $data, $entity = null)
 {
     $data['produto'] = $this->getEmRef('Admin\\Entity\\Produto', $data['produto']);
     parent::insert($data);
 }
Ejemplo n.º 17
0
 public function __construct($settings)
 {
     parent::bootstrap();
     $this->settings = $settings;
     parent::$serviceInstance[get_class()] = $this;
 }
Ejemplo n.º 18
0
 public function insert(array $data, $entity = null)
 {
     $data['slug'] = $this->titleToSlug($data['title']);
     parent::insert($data);
 }
Ejemplo n.º 19
0
 protected function __construct()
 {
     parent::__construct(\Sb\Db\Dao\InvitationDao::getInstance(), "Invitation");
 }
Ejemplo n.º 20
0
 public function insert($spec)
 {
     $id = parent::insert($spec);
     $spec = $this->find(array('spec_id' => $id));
     return $spec;
 }
Ejemplo n.º 21
0
 public function delete($id)
 {
     $pdo = PDOBuilder::getPdo();
     $newTransaction = !$pdo->inTransaction();
     if ($newTransaction) {
         $pdo->beginTransaction();
     }
     // Delete rules
     $stmt = $pdo->prepare("DELETE FROM PAYMENTMODES_RETURNS " . "WHERE PAYMENTMODE_ID = :id;");
     $stmt->bindValue(":id", $id);
     if ($stmt->execute() === false) {
         if ($newTransaction) {
             $pdo->rollback();
         }
         return false;
     }
     // Delete values
     $stmtVal = $pdo->prepare("DELETE FROM PAYMENTMODES_VALUES " . "WHERE PAYMENTMODE_ID = :id;");
     $stmtVal->bindValue(":id", $id);
     if ($stmtVal->execute() === false) {
         if ($newTransaction) {
             $pdo->rollback();
         }
         return false;
     }
     // Delete mode
     $del = parent::delete($id);
     if ($del === false) {
         if ($newTransaction) {
             $pdo->rollback();
         }
         return false;
     } else {
         if ($newTransaction) {
             $pdo->commit();
         }
         return $del;
     }
 }
Ejemplo n.º 22
0
 protected function __construct()
 {
     parent::__construct(new \Sb\Db\Dao\ReadingStateDao(), "ReadingState");
 }
Ejemplo n.º 23
0
 public function update(array $data, $id, $entity = null)
 {
     $data['transporte'] = $this->getEmRef('Admin\\Entity\\Transporte', $data['transporte']);
     parent::update($data, $id);
 }
Ejemplo n.º 24
0
 protected function __construct()
 {
     parent::__construct(\Sb\Db\Dao\UserBookGiftDao::getInstance(), "UserBookGift");
 }
Ejemplo n.º 25
0
 function __construct($mapPath)
 {
     parent::__construct();
     $this->mapPath = $mapPath;
 }
Ejemplo n.º 26
0
 public function __construct(Application $app, RepositoryInterface $repository)
 {
     parent::__construct($app);
     $this->repository = $repository;
 }
Ejemplo n.º 27
0
 public function insert($availability)
 {
     parent::insert($availability);
     return $availability;
 }
Ejemplo n.º 28
0
 protected function __construct()
 {
     parent::__construct(\Sb\Db\Dao\MessageDao::getInstance(), "Message");
 }
Ejemplo n.º 29
0
 public function insert($product)
 {
     $id = parent::insert($product);
     return $this->find(array('product_id' => $id));
 }
Ejemplo n.º 30
0
 public function delete($areaId)
 {
     $pdo = PDOBuilder::getPDO();
     $del = $pdo->prepare("DELETE FROM TARIFFAREAS_PROD " . "WHERE TARIFFID = :id");
     $del->bindParam(":id", $areaId);
     $del->execute();
     return parent::delete($areaId);
 }