当前位置: 首页>>代码示例>>PHP>>正文


PHP Stock::find_all方法代码示例

本文整理汇总了PHP中Stock::find_all方法的典型用法代码示例。如果您正苦于以下问题:PHP Stock::find_all方法的具体用法?PHP Stock::find_all怎么用?PHP Stock::find_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stock的用法示例。


在下文中一共展示了Stock::find_all方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Stock

 function _titoli($mercato)
 {
     $conn = $this->get_connection();
     $stock_factory = new Stock();
     $stocks = $stock_factory->find_all(array('where_clause' => "`attivo` = 1 " . ($mercato !== NULL ? " AND `mercato` = '{$conn->escape($mercato)}' " : ''), 'order_by' => '`title` ASC ', 'limit' => 99999999));
     if (count($stocks) > 0) {
         $this->stocks = array_map(function ($t) {
             return "\t{\n\t\t\"isin\": \"" . $t->isin . "\",\n\t\t\"title\": \"" . $t->title . "\"\n\t}";
         }, $stocks);
     }
     $this->render(array('action' => 'titoli', 'layout' => FALSE));
 }
开发者ID:emeraldion,项目名称:creso,代码行数:12,代码来源:json_controller.php

示例2: index

 /**
  *  @fn index
  *  @short Lists active instruments
  *  @details Action to list the catalog of active instruments, filtered by
  *  attributes like market, type, currency, and sorted by any of the columns
  *  (defaults to <code>title</code>).
  */
 public function index()
 {
     $conn = $this->get_connection();
     $stock_factory = new Stock();
     $details = array('where_clause' => (is_numeric($_REQUEST['attivo']) ? "`attivo` = {$conn->escape($_REQUEST['attivo'])} " : '`attivo` = 1 ') . (!empty($_REQUEST['mercato']) ? "AND `mercato` = '{$conn->escape($_REQUEST['mercato'])}' " : '') . (!empty($_REQUEST['tipo']) ? "AND `tipo` = '{$conn->escape($_REQUEST['tipo'])}' " : '') . (!empty($_REQUEST['divisa']) ? "AND `divisa` = '{$conn->escape($_REQUEST['divisa'])}' " : ''), 'order_by' => sprintf('`%s` %s', $this->get_sort('title'), $this->get_dir()), 'start' => $this->get_start(), 'limit' => $this->get_limit());
     $this->stocks = $stock_factory->find_all($details);
     $this->count = $stock_factory->count_all($details);
     if ($_REQUEST['tipo'] == 'obbligazione') {
         $this->bonds_only = TRUE;
         foreach ($this->stocks as $stock) {
             $stock->has_one('bond');
         }
     }
 }
开发者ID:emeraldion,项目名称:creso,代码行数:21,代码来源:titoli_controller.php

示例3: add

 function add()
 {
     if ($this->request->is_post()) {
         $item = new Dividend($_POST);
         $item->save();
         $this->redirect_to(array('action' => 'index'));
     } else {
         $stock_factory = new Stock();
         $stocks = $stock_factory->find_all(array('where_clause' => '`attivo` = 1', 'order_by' => '`title` ASC'));
         $this->stocks = array('-1' => 'Scegli...');
         foreach ($stocks as $stock) {
             $this->stocks[$stock->isin] = $stock->title;
         }
     }
 }
开发者ID:emeraldion,项目名称:creso,代码行数:15,代码来源:dividendi_controller.php

示例4: add

 function add()
 {
     if ($this->request->is_post()) {
         $transaction = new Transaction($_POST);
         // Salvo la transazione
         $transaction->save();
         $this->redirect_to(array('action' => 'index'));
     } else {
         $stock_factory = new Stock();
         $stocks = $stock_factory->find_all(array('where_clause' => "`attivo` = 1 ", 'order_by' => '`title` ASC', 'limit' => 9999));
         $this->stocks = array('' => 'Scegli...');
         foreach ($stocks as $stock) {
             $this->stocks[$stock->isin] = $stock->title;
         }
     }
 }
开发者ID:emeraldion,项目名称:creso,代码行数:16,代码来源:transazioni_controller.php

示例5: add

 function add()
 {
     if ($this->request->is_post()) {
         $item = new WatchlistItem($_POST);
         $item->utente = $_COOKIE['username'];
         $item->save();
         $this->redirect_to(array('action' => 'index'));
     } else {
         if (!empty($_GET['id'])) {
             $this->stock = new Stock();
             $this->stock->find_by_id($_GET['id']);
             $this->render(array('action' => 'add_by_isin'));
         } else {
             $stock_factory = new Stock();
             $stocks = $stock_factory->find_all(array('where_clause' => '`attivo` = 1', 'order_by' => '`title` ASC'));
             $this->stocks = array('-1' => 'Scegli...');
             foreach ($stocks as $stock) {
                 $this->stocks[$stock->isin] = $stock->title;
             }
         }
     }
 }
开发者ID:emeraldion,项目名称:creso,代码行数:22,代码来源:watchlist_controller.php

示例6: test_find_all_where_clause

 public function test_find_all_where_clause()
 {
     $instance_factory = new Stock();
     $instances = $instance_factory->find_all(array('where_clause' => "`isin` = 'IT0000000000'"));
     $this->assertNotNull($instances);
     $this->assertEquals(1, count($instances));
     foreach ($instances as $instance) {
         $this->assertNotNull($instance);
         $this->assertEquals('IT0000000000', $instance->isin);
     }
     $instances = $instance_factory->find_all(array('where_clause' => "`tipo` = 'azione'"));
     $this->assertNotNull($instances);
     $this->assertEquals(2, count($instances));
     foreach ($instances as $instance) {
         $this->assertNotNull($instance);
         $this->assertEquals('azione', $instance->tipo);
     }
 }
开发者ID:emeraldion,项目名称:creso,代码行数:18,代码来源:stock.test.php

示例7: date

    $error->date = date('Y-m-d H:i:s');
    $error->text = $errstr;
    $error->save();
}
class SchedulerContext
{
    public $stocks = array();
    public $preferences = NULL;
}
// set_error_handler('handle_errors', E_ALL | E_STRICT | E_NOTICE | ~E_DEPRECATED);
date_default_timezone_set('Europe/Rome');
echo "Reading preferences...";
$preference_factory = new Preference();
$preferences = $preference_factory->find_all()[0];
// print_r($preferences);
echo "done\n";
$stock_factory = new Stock();
$stocks = $stock_factory->find_all(array('limit' => 1500));
// print_r($stocks);
$context = new SchedulerContext();
$context->stocks = $stocks;
$context->preferences = $preferences;
if (isset($argv[1])) {
    $arg = $argv[1];
    if (is_numeric($arg)) {
        $context->level = $argv[1];
    } else {
        $context->agent_name = $arg;
    }
}
AgentPool::run_pool($context);
开发者ID:emeraldion,项目名称:creso,代码行数:31,代码来源:scheduler.php

示例8: get_stocks

 private function get_stocks($stock_deltas)
 {
     $conn = $this->get_connection();
     $stock_factory = new Stock();
     $params = array('where_clause' => "`isin` IN ('" . implode("','", array_map($conn->escape, array_keys($stock_deltas))) . "')" . (!empty($_REQUEST['mercato']) ? "AND `mercato` = '{$conn->escape($_REQUEST['mercato'])}' " : '') . (!empty($_REQUEST['tipo']) ? "AND `tipo` = '{$conn->escape($_REQUEST['tipo'])}' " : '') . (!empty($_REQUEST['divisa']) ? "AND `divisa` = '{$conn->escape($_REQUEST['divisa'])}' " : ''), 'order_by' => sprintf('`%s` %s ', $this->get_sort('isin'), $this->get_dir()), 'start' => $this->get_start(), 'limit' => $this->get_limit());
     $stocks = $stock_factory->find_all($params);
     $results = array();
     foreach ($stocks as $stock) {
         $p = new PortfolioStock();
         $p->isin = $stock->isin;
         $p->quantita = abs($stock_deltas[$p->isin]);
         $p->stock = $stock;
         $p->removed = TRUE;
         // TODO:
         // $p->prezzo =
         $results[] = $p;
     }
     return $results;
 }
开发者ID:emeraldion,项目名称:creso,代码行数:19,代码来源:portfolio_controller.php

示例9: dirname

<?php 
ini_set('max_execution_time', 3000);
require_once dirname(__FILE__) . "/lib.inc.php";
require_once dirname(__FILE__) . "/../include/db.inc.php";
require_once dirname(__FILE__) . "/../include/" . DB_ADAPTER . "_adapter.php";
require_once dirname(__FILE__) . "/../models/preference.php";
require_once dirname(__FILE__) . "/../models/bond.php";
require_once dirname(__FILE__) . "/../models/stock.php";
date_default_timezone_set('Europe/Rome');
echo "Reading preferences...";
$preference_factory = new Preference();
$preferences = $preference_factory->find_all()[0];
// print_r($preferences);
echo "done\n";
$stock_factory = new Stock();
$stocks = $stock_factory->find_all(array('where_clause' => "`tipo`='obbligazione'", 'limit' => 1500));
foreach ($stocks as $stock) {
    if (!$stock->attivo) {
        continue;
    }
    // print_r($stock);
    $bond = new Bond();
    if (!$bond->find_by_id($stock->isin)) {
        switch ($stock->mercato) {
            case "eurotlx":
                $bond = new Bond(isin2bond_tlx($stock->isin, $preferences->isin_lookup_eurotlx));
                $bond->isin = $stock->isin;
                break;
            case "tlx":
                $bond = new Bond(isin2bond_tlx($stock->isin, $preferences->isin_lookup_eurotlx));
                $bond->isin = $stock->isin;
开发者ID:emeraldion,项目名称:creso,代码行数:31,代码来源:populate_bonds.php


注:本文中的Stock::find_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。