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


PHP Item::setName方法代码示例

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


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

示例1: test_accessors

 public function test_accessors()
 {
     /** === Test Data === */
     $NAME = 'name';
     $LEVEL = 'level';
     /** === Setup Mocks === */
     /** === Call and asserts  === */
     $this->obj->setName($NAME);
     $this->obj->setLevel($LEVEL);
     $this->assertEquals($NAME, $this->obj->getName());
     $this->assertEquals($LEVEL, $this->obj->getLevel());
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_core,代码行数:12,代码来源:Item_Test.php

示例2: gerateBilling

 public function gerateBilling()
 {
     $order = null;
     $customers = $this->getUserID();
     $structJsonArray = array();
     foreach ($customers as $customer) {
         $structJson = new Json();
         $structJson->setCustomerId($customer['zoho_books_contact_id']);
         $structJson->setDate(date('d-m-Y'));
         $invoices_per_costumer = $this->getUserInvoice($customer['zoho_books_contact_id']);
         //var_dump($invoices_per_costumer);
         foreach ($invoices_per_costumer as $invoice_each) {
             $item = new Item();
             $order++;
             $item->setItemId("460000000027017");
             $item->setProjectId("");
             $item->setExpenseId("");
             $item->setName("Print Services");
             $item->setDescription($invoice_each['description']);
             $item->setItemOrder($order);
             $item->setRate($invoice_each['rate']);
             $item->setUnit("Nos");
             $item->setQuantity(1.0);
             $item->setDiscount(0.0);
             $item->setTaxId("460000000027005");
             $structJson->setLineItems($item);
             $item = null;
         }
         $structJson->setNotes("Thanks for your business.");
         $order = null;
         $structJsonArray[] = $structJson;
         $structJson = null;
     }
     return $structJsonArray;
 }
开发者ID:denisolvr,项目名称:Billing-Code-Test,代码行数:35,代码来源:Bill.php

示例3: __construct

 /**
  * @return void
  **/
 public function __construct()
 {
     $fp = fopen(ROOT . '/data/AbstractFactory/item.csv', 'r');
     while ($data = fgetcsv($fp, 1000, ',')) {
         $item = new Item();
         $item->setId($data[0]);
         $item->setName($data[1]);
         $this->items[$item->getId()] = $item;
     }
     fclose($fp);
 }
开发者ID:app2641,项目名称:DesignPatternOnPHP,代码行数:14,代码来源:DbItemDao.php

示例4: create

    public function create(Category $category, $name, $price, $stock, $image, $description)
    {
        $errors = array();
        $item = new Item($this->db);
        try {
            $item->setCategory($category);
        } catch (Exception $e) {
            $errors[] = $e->getMessage();
        }
        try {
            $item->setName($name);
        } catch (Exception $e) {
            $errors[] = $e->getMessage();
        }
        try {
            $item->setPrice($price);
        } catch (Exception $e) {
            $errors[] = $e->getMessage();
        }
        try {
            $item->setStock($stock);
        } catch (Exception $e) {
            $errors[] = $e->getMessage();
        }
        try {
            $item->setImage($image);
        } catch (Exception $e) {
            $errors[] = $e->getMessage();
        }
        try {
            $item->setDescription($description);
        } catch (Exception $e) {
            $errors[] = $e->getMessage();
        }
        if (count($errors) == 0) {
            $name = $this->db->quote($item->getName());
            $price = $this->db->quote($item->getPrice());
            $stock = $this->db->quote($item->getStock());
            $image = $this->db->quote($item->getImage());
            $description = $this->db->quote($item->getDescription());
            $idCategory = $item->getCategory()->getId();
            $query = '	INSERT INTO item (id_category, name, price, stock, image, description)
								VALUES(' . $idCategory . ',' . $name . ',' . $price . ',' . $stock . ',' . $image . ',' . $description . ')';
            $res = $this->db->exec($query);
            if ($res) {
                $id = $this->db->lastInsertId();
                if ($id) {
                    return $this->readByID($id);
                } else {
                    throw new Exception('Internal server Error');
                }
            }
        }
    }
开发者ID:dispxxx,项目名称:leshop,代码行数:54,代码来源:ItemManager.class.php

示例5: testSetGetName

 public function testSetGetName()
 {
     // Arrange
     $item = new Item();
     $item->setName('john');
     $expectedResult = 'john';
     // Act
     $result = $item->getName();
     // Assert
     $this->assertEquals($result, $expectedResult);
 }
开发者ID:Owen66,项目名称:KBK-WebSite,代码行数:11,代码来源:ItemTest.php

示例6: buildRawExamples

 public static function buildRawExamples()
 {
     // Order persons
     echo ' 8: Initial data: <pre>';
     var_dump(\OrderPerson::getListOfTypeOrderPerson(array('forAutocompletion' => false)));
     echo '</pre>';
     // Inserting an order person
     $newOrderPerson = new \OrderPerson();
     $newOrderPerson->setEmail('lilian.tikk03@gmail.com');
     $newOrderPerson->setFirstName('lilian');
     $newOrderPerson->setLastName('tikk');
     $newOrderPerson->insert();
     echo ' 10: After insertion: <pre>';
     var_dump(\OrderPerson::getListOfTypeOrderPerson(array('forAutocompletion' => false)));
     echo '</pre>';
     // Querying full data of an order person
     $orderPerson = new OrderPerson();
     $orderPerson->setId(3);
     $orderPerson->setCompleteOrderPerson();
     echo ' 20: Order person #3: <pre>';
     var_dump($orderPerson);
     echo '</pre>';
     // Updating data of an order person
     $orderPerson->setAddress('Pärnu, Pärnu');
     $orderPerson->update();
     echo ' 24: After updating the order person #3: <pre>';
     var_dump(\OrderPerson::getListOfTypeOrderPerson(array('forAutocompletion' => false)));
     echo '</pre>';
     // Deleting the order person #2
     $orderPerson = new \OrderPerson();
     $orderPerson->setId(2);
     $orderPerson->delete();
     echo ' 43: After deleting the order person #2: <pre>';
     var_dump(\OrderPerson::getListOfTypeOrderPerson(array('forAutocompletion' => false)));
     echo '</pre>';
     // Items
     require_once dirname(__FILE__) . '/Item.php';
     $item = new Item();
     $item->setId(1);
     $item->setName('õun');
     $item->setPrice(1.0);
     $item->setAmount(20.0);
     $item->insertItem($item);
     $item = new \shiporder\Item();
     $item->setId(2);
     $item->setName('pirn');
     $item->setPrice(2.0);
     $item->setAmount(10.0);
     $item->insertItem($item);
     $items = $item->getItems();
     var_dump($items);
 }
开发者ID:piiskop,项目名称:pstk,代码行数:52,代码来源:OrderPersonController.php

示例7: testIndexItemExists

 public function testIndexItemExists()
 {
     // create mocks
     $apiMethods = array('getUserId', 'getSystemValue', 'add3rdPartyScript', 'addStyle', 'addScript');
     $api = $this->getAPIMock($apiMethods);
     $api->expects($this->any())->method('getUserId')->will($this->returnValue('richard'));
     $item = new Item();
     $item->setUser('user');
     $item->setPath('/path');
     $item->setId(3);
     $item->setName('name');
     $itemMapperMock = $this->getMock('ItemMapper', array('findByUserId'));
     $itemMapperMock->expects($this->any())->method('findByUserId')->will($this->returnValue($item));
     $controller = new ItemController($api, null, $itemMapperMock);
     $response = $controller->index();
     $params = $response->getParams();
     $this->assertEquals($item, $params['item']);
 }
开发者ID:nanowish,项目名称:apps,代码行数:18,代码来源:ItemControllerTest.php

示例8: createAction

 function createAction(Request $request, Application $app)
 {
     if (null === ($user = $app['session']->get('user'))) {
         return $app->redirect('/login');
     }
     $newItem = new Item();
     $newItem->setName($request->get('name'));
     $newItem->setDescription($request->get('description'));
     $newItem->setPrice($request->get('price'));
     $newItem->setCalories($request->get('calories'));
     $newItem->setAllergyInformation($request->get('allergyInformation'));
     $em = $app['orm.em'];
     $categoryRepository = $em->getRepository('Category');
     $Category = $categoryRepository->find($request->get('category'));
     $newItem->setCategory($Category);
     $file = $request->files->get('photo');
     $newItem->setPhoto($file->getClientOriginalName());
     $file = $request->files->get('photo');
     $file->move(__DIR__ . '/../public/img', $file->getClientOriginalName());
     $em->persist($newItem);
     $em->flush();
     return $app->redirect('/itemAdmin');
 }
开发者ID:Owen66,项目名称:KBK-WebSite,代码行数:23,代码来源:ItemController.php

示例9: index

 /**
  * @CSRFExcemption
  * @IsAdminExcemption
  * @IsSubAdminExcemption
  *
  * @brief renders the index page
  * @param array $urlParams: an array with the values, which were matched in 
  *                          the routes file
  * @return an instance of a Response implementation
  */
 public function index($urlParams = array())
 {
     // thirdparty stuff
     $this->api->add3rdPartyScript('angular/angular.min');
     // your own stuff
     $this->api->addStyle('style');
     $this->api->addStyle('animation');
     $this->api->addScript('app');
     // example database access
     // check if an entry with the current user is in the database, if not
     // create a new entry
     try {
         $item = $this->itemMapper->findByUserId($this->api->getUserId());
     } catch (DoesNotExistException $e) {
         $item = new Item();
         $item->setUser($this->api->getUserId());
         $item->setPath('/home/path');
         $item->setName('john');
         $this->itemMapper->save($item);
     }
     $templateName = 'main';
     $params = array('somesetting' => $this->api->getSystemValue('somesetting'), 'item' => $item);
     return $this->render($templateName, $params);
 }
开发者ID:nanowish,项目名称:apps,代码行数:34,代码来源:item.controller.php

示例10: create

 /**
  * @param Subcategory $subcategory
  * @param $name
  * @param $descr
  * @param $short_descr
  * @param $price
  * @param $stock
  * @return array
  * @throws Exception
  */
 public function create(Subcategory $subcategory, $name, $descr, $short_descr, $price, $stock)
 {
     $errors = array();
     $item = new Item($this->db);
     try {
         $item->setName($name);
         $item->setDescription($descr);
         $item->setShortDescription($short_descr);
         $item->setPrice($price);
         $item->setStock($stock);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     if (count($errors) == 0) {
         $name = $this->db->quote($item->getName());
         $description = $this->db->quote($item->getDescription());
         $shortDescription = $this->db->quote($item->getShortDescription());
         $price = $this->db->quote($item->getPrice());
         $stock = $this->db->quote($item->getStock());
         $query = "  INSERT INTO item(id_subcategory, name, descr, short_descr, price, stock)\n                               VALUES(" . $subcategory->getId() . ", " . $name . ", " . $description . ", " . $shortDescription . ", " . $price . ", " . $stock . ")";
         $data = $this->db->exec($query);
         if ($data) {
             $id = $this->db->lastInsertId();
             if ($id) {
                 try {
                     return $this->findById($id);
                 } catch (Exception $e) {
                     $errors[] = $e->getMessage();
                     return $errors;
                 }
             } else {
                 throw new Exception('Last insert error');
             }
         } else {
             throw new Exception('Db error');
         }
     } else {
         return $errors;
     }
 }
开发者ID:CreepingPanda,项目名称:FennecPlusUltra,代码行数:50,代码来源:ItemManager.class.php

示例11: getItems

 static function getItems(Feed &$feed)
 {
     $fid = $feed->getId();
     $text = $feed->getMessage();
     static::doParse($text);
     $assocs = static::$array;
     $result = array();
     foreach ($assocs as $index => $assoc) {
         $item = new Item();
         $item->setId($fid . '_' . $index);
         $item->setFeed($feed);
         if (isset($assoc['type'])) {
             $item->setType($assoc['type']);
         } else {
             $item->setType('GLOBAL');
         }
         if (isset($assoc['description'])) {
             $item->setDescription($assoc['description']);
         }
         if (isset($assoc['global'])) {
             $item->setGlobal($assoc['global']);
         }
         if (isset($assoc['name'])) {
             $item->setName($assoc['name']);
         }
         if (isset($assoc['note'])) {
             $item->setNote($assoc['note']);
         }
         if (isset($assoc['price_digit'])) {
             $item->setPrice($assoc['price_digit']);
         }
         if (isset($assoc['price'])) {
             $item->setPriceStr($assoc['price']);
         }
         if (isset($assoc['status'])) {
             $item->setStatus($assoc['status']);
         }
         $result[] = $item;
     }
     if (!$result) {
         $item = new Item();
         $item->setId($fid . '_0');
         $item->setFeed($feed);
         $item->setType('GLOBAL');
         $item->setGlobal($text);
         $result[] = $item;
     }
     return $result;
 }
开发者ID:hchsiao,项目名称:xdbrowser-DEPRECATED,代码行数:49,代码来源:ItemFactory.php

示例12: array

<?php

$items = array();
$item = new Item();
$item->setName("RaumZeitLabor T-Shirt");
$item->setDescription("Das Super RZL Shirt");
$item->setImage("tshirt.jpg");
$item->addSizePrice(new SizePrice("XXL", 15.9));
$item->addSizePrice(new SizePrice("XL", 14.9));
$item->addSizePrice(new SizePrice("L", 13.9));
$item->addSizePrice(new SizePrice("M", 12.9));
$item->addSizePrice(new SizePrice("S", 11.9));
$items[] = $item;
$item = new Item();
$item->setName("RZL LabCoat");
$item->setDescription("Das Pflichtprogramm für jeden Laboraten! Ein bestickter Labcoat, der auch " . "wunderbar für Ätzsessions geeignet ist. Die Bestickung wird von Unicorn oder Inte " . "mittels unserer Stickmaschine vorgenommen.");
$item->setImage("labcoat.jpg");
$item->addSizePrice(new SizePrice("XXL", 15.9));
$item->addSizePrice(new SizePrice("XL", 14.9));
$item->addSizePrice(new SizePrice("L", 13.9));
$item->addSizePrice(new SizePrice("M", 12.9));
$item->addSizePrice(new SizePrice("S", 11.9));
$items[] = $item;
开发者ID:nazco,项目名称:rzl_merchandise,代码行数:23,代码来源:config.php

示例13: SizePrice

$item->addSizePrice(new SizePrice("M", 25.0));
$item->addSizePrice(new SizePrice("S", 25.0));
$items[] = $item;
$item = new Item();
$item->setName("Zipper");
$item->setDescription("Wer mag es nicht, das flauschige Allwetterkleidungsstück für den Nerd von heute. " . "\n\nAuf Wunsch mit eigenem Schriftzug.");
$item->setImage("zipper.jpg");
$item->addSizePrice(new SizePrice("XXL", 35.0));
$item->addSizePrice(new SizePrice("XL", 35.0));
$item->addSizePrice(new SizePrice("L", 35.0));
$item->addSizePrice(new SizePrice("M", 35.0));
$item->addSizePrice(new SizePrice("S", 35.0));
$items[] = $item;
$item = new Item();
$item->setName("Laser-Foo");
$item->setDescription("Diverse Gegenstände, die wir erfolgreich einer Laserbehandlung unterzogen haben.");
$item->setImage("pfannenwender.jpg");
$item->addSizePrice(new SizePrice("Pfannenwender mit Logo", 5.0));
$item->addSizePrice(new SizePrice("Minecraft-Spaten", 5.0));
$items[] = $item;
$item = new Item();
$item->setName("Schürze");
$item->setDescription("Es soll auch Nerds geben, die sich in die Küche trauen. Das wollen wir natürlich " . "unterstützen! Die Bestickung wird von unseren Fachkräften Unicorn oder Inte mittels " . "unserer programmierbaren Stickmaschine vorgenommen.");
$item->setImage("schuerze.jpg");
$item->addSizePrice(new SizePrice("XXL", 20.0));
$item->addSizePrice(new SizePrice("XL", 20.0));
$item->addSizePrice(new SizePrice("L", 20.0));
$item->addSizePrice(new SizePrice("M", 20.0));
$item->addSizePrice(new SizePrice("S", 20.0));
$items[] = $item;
$targetMails = array("vorstand@raumzeitlabor.de", "mail@oliverknapp.de");
开发者ID:raphaelm,项目名称:rzl_merchandise,代码行数:31,代码来源:config.php

示例14: setHoldItem

 public function setHoldItem($hold_item)
 {
     if ($hold_item) {
         $item = new Item();
         $item->setName($hold_item);
         return $item;
     }
     unset($this->hold_item);
 }
开发者ID:Nick737373,项目名称:TPP.org,代码行数:9,代码来源:Pokemon.php


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