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


PHP Inventory::getAll方法代码示例

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


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

示例1: find

 static function find($search_id)
 {
     $found_item = null;
     $items = Inventory::getAll();
     foreach ($items as $item) {
         $item_id = $item->getId();
         if ($item_id == $search_id) {
             $found_item = $item;
         }
     }
     return $found_item;
 }
开发者ID:kylepratuch,项目名称:Inventory,代码行数:12,代码来源:Inventory.php

示例2: test_deleteAll

 function test_deleteAll()
 {
     $item = "POGs";
     $item2 = "Pokemon Cards";
     $test_item = new Inventory($item);
     $test_item->save();
     $test_item2 = new Inventory($item2);
     $test_item2->save();
     Inventory::deleteAll();
     $result = Inventory::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:CaseyH33,项目名称:Inventory-MySQL,代码行数:12,代码来源:InventoryTest.php

示例3: find

 static function find($search_item)
 {
     $found_item = NULL;
     $inventory = Inventory::getAll();
     foreach ($inventory as $item) {
         $item_name = $item->getItem();
         if ($item_name == $search_item) {
             $found_item = $item;
         }
     }
     return $found_item;
 }
开发者ID:CaseyH33,项目名称:Inventory-MySQL,代码行数:12,代码来源:Inventory.php

示例4: find

 static function find($search_id)
 {
     $found_inventory = null;
     $inventory_array = Inventory::getAll();
     foreach ($inventory_array as $inventory_item) {
         $inventory_id = $inventory_item->getId();
         if ($inventory_id == $search_id) {
             $found_inventory = $inventory_item;
         }
     }
     return $found_inventory;
 }
开发者ID:CharlesAMoss,项目名称:epic_Inventory,代码行数:12,代码来源:Inventory.php

示例5: test_deleteAll

 function test_deleteAll()
 {
     //Arrange
     $item = "Antique Toothpick Holders";
     $item2 = "Ornamental Mouse Traps";
     $test_Inventory = new Inventory($item);
     $test_Inventory->save();
     $test_Inventory2 = new Inventory($item2);
     $test_Inventory2->save();
     //Act
     Inventory::deleteAll();
     //Assert
     $result = Inventory::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:alexdbrown,项目名称:sql-inventory,代码行数:15,代码来源:InventoryTest.php

示例6: test_deleteAll

 function test_deleteAll()
 {
     //Arrange
     $description = "Blue candy";
     $description2 = "Light blue candy";
     $test_Inventory = new Inventory($description);
     $test_Inventory->save();
     $test_Inventory2 = new Inventory($description2);
     $test_Inventory2->save();
     //Act
     Inventory::deleteAll();
     //Assert
     $result = Inventory::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:kylepratuch,项目名称:Inventory,代码行数:15,代码来源:InventoryTest.php

示例7: PDO

<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Inventory.php";
$app = new Silex\Application();
$server = 'mysql:host=localhost;dbname=inventory';
$username = 'root';
$password = 'root';
$DB = new PDO($server, $username, $password);
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get("/", function () use($app) {
    return $app['twig']->render('index.html.twig', array('inventory' => Inventory::getAll()));
});
$app->post("/create", function () use($app) {
    $inventory = new Inventory($_POST['item']);
    $inventory->save();
    return $app['twig']->render('index.html.twig', array('inventory' => Inventory::getAll()));
});
$app->post("/delete", function () use($app) {
    Inventory::deleteAll();
    return $app['twig']->render('index.html.twig');
});
$app->get("/search", function () use($app) {
    $search = Inventory::find($_GET['search']);
    return $app['twig']->render('search.html.twig', array('search' => $search, 'search_term' => $_GET['search']));
});
return $app;
开发者ID:CaseyH33,项目名称:Inventory-MySQL,代码行数:27,代码来源:app.php

示例8: PDO

<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Inventory.php";
$app = new Silex\Application();
$server = 'mysql:host=localhost;dbname=inventory';
$username = 'root';
$password = 'root';
$DB = new PDO($server, $username, $password);
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get("/", function () use($app) {
    return $app['twig']->render('index.html.twig', array('candies' => Inventory::getAll()));
});
$app->get("/candies", function () use($app) {
    return $app['twig']->render('candies.html.twig', array('candies' => Inventory::getAll()));
});
$app->post("/candies", function () use($app) {
    $candy = new Inventory($_POST['name']);
    $candy->save();
    return $app['twig']->render('candies.html.twig', array('candies' => Inventory::getAll()));
});
$app->post("/delete_candy", function () use($app) {
    Inventory::deleteAll();
    return $app['twig']->render('index.html.twig');
});
$app->get("/found_candy", function () use($app) {
    return $app['twig']->render('found_candy.html.twig', array('candies' => Inventory::find($_GET['search'])));
});
return $app;
开发者ID:kylepratuch,项目名称:Inventory,代码行数:29,代码来源:app.php


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