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


PHP Brand::setName方法代码示例

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


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

示例1: Brand

 function test_setName()
 {
     $name = "Nike";
     $test_brand = new Brand($name, $id);
     $test_brand->setName("Foot Action");
     $result = $test_brand->getName();
     $this->assertEquals("Foot Action", $result);
 }
开发者ID:jeffaustin81,项目名称:shoe_store,代码行数:8,代码来源:BrandTest.php

示例2: testSetName

 function testSetName()
 {
     //Arrange
     $brand_name = "nike";
     $test_brand = new Brand($brand_name);
     //Act
     $test_brand->setName("puma");
     $result = $test_brand->getName();
     //Assert
     $this->assertEquals("puma", $result);
 }
开发者ID:bencasalino,项目名称:shoe-store,代码行数:11,代码来源:BrandTest.php

示例3: testSetName

 function testSetName()
 {
     //Arrange
     $name = "addidas";
     $test_brand = new Brand($name);
     $new_name = "nike";
     //Act
     $test_brand->setName($new_name);
     $result = $test_brand->getName();
     //Assert
     $this->assertEquals($new_name, $result);
 }
开发者ID:bencasalino,项目名称:cr4,代码行数:12,代码来源:BrandTest.php

示例4: Brand

 function test_setName()
 {
     //Arrange
     $name = "Running";
     $id = 1;
     $test_brand = new Brand($name, $id);
     //Act
     $test_brand->setName("work");
     $result = $test_brand->getName();
     //Assert
     $this->assertEquals($result, "work");
 }
开发者ID:bdspen,项目名称:ShoeStore,代码行数:12,代码来源:BrandTest.php

示例5: testSetName

 function testSetName()
 {
     //Arrange
     $name = "Adidas";
     $id = 1;
     $test_brand = new Brand($name, $id);
     //Act
     $test_brand->setName("Nike");
     $result = $test_brand->getName();
     //Assert
     $this->assertEquals("Nike", $result);
 }
开发者ID:bborealis,项目名称:shoes,代码行数:12,代码来源:BrandTest.php

示例6: importBrands

 public function importBrands(Import $entity, $output)
 {
     $em = $this->container->get('doctrine')->getManager();
     $sql = ' SELECT m.id_marca, m.nombre, m.slug FROM  `marca` AS m ' . ' ORDER BY m.id_marca ';
     //                . ' LIMIT '.$entity->getLimitStart().', '.$entity->getLimitEnd();
     $link = mysqli_connect($entity->getServer(), $entity->getUsername(), $entity->getPassword(), $entity->getDbname()) or die('No se pudo conectar: ' . mysqli_error($link));
     $resultado = $link->query($sql);
     $arrayBrand = array();
     if (mysqli_num_rows($resultado) > 0) {
         while ($fila = mysqli_fetch_assoc($resultado)) {
             if (!in_array(utf8_encode($fila['nombre']), $arrayBrand)) {
                 //Create Brands
                 $brand = new Brand();
                 $brand->setName(utf8_encode($fila['nombre']));
                 $brand->setAvailable(true);
                 $em->persist($brand);
                 $arrayBrand[] = utf8_encode($fila['nombre']);
             }
         }
         $em->flush();
     }
 }
开发者ID:sebardo,项目名称:core,代码行数:22,代码来源:ImportCommand.php

示例7: create

 /**
  * @param $name
  * @param $description
  * @param array $errors
  * @return object
  * @throws Exception
  */
 public function create($name, $description, $errors = array())
 {
     $brand = new Brand($this->db);
     try {
         $brand->setName($name);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     try {
         $brand->setDescription($description);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     if (count($errors) == 0) {
         $name = $this->db->quote($brand->getName());
         $description = $this->db->quote($brand->getDescription());
         $query = "INSERT INTO brand (name, description) VALUES(" . $name . ", " . $description . ")";
         $data = $this->db->exec($query);
         if ($data) {
             $id = $this->db->lastInsertId();
             if ($id) {
                 try {
                     $brand = $this->findById($id);
                     return $brand;
                 } catch (Exception $e) {
                     $errors[] = $e->getMessage();
                     return $errors;
                 }
             } else {
                 throw new Exception('Last insert error');
             }
         } else {
             throw new Exception('Insert error');
         }
     } else {
         return $errors;
     }
 }
开发者ID:dispix,项目名称:dashboard,代码行数:45,代码来源:BrandManager.class.php


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