Product::getTitle PHP Method

getTitle() public method

public getTitle ( ) : string
return string
    public function getTitle()
    {
        return $this->title ?: $this->name;
    }

Usage Example

 /**
  * test grabbing a Product by alertId
  **/
 public function testGetValidProductByAlertId()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("alertLevel");
     // create a new alertLevel and insert to into mySQL
     $alertLevel = new AlertLevel(null, $this->VALID_alertCode, $this->VALID_alertFrequency, $this->VALID_alertPoint, $this->VALID_alertOperator);
     $alertLevel->insert($this->getPDO());
     // create a new productAlert and insert to into mySQL
     $productAlert = new productAlert($alertLevel->getAlertId(), $this->product->getProductId(), true);
     $productAlert->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoProductArray = AlertLevel::getProductByAlertId($this->getPDO(), $alertLevel->getAlertId());
     for ($i = 0; $i < count($pdoProductArray); $i++) {
         if ($i === 0) {
             $this->assertSame($pdoProductArray[$i]->getAlertCode(), $this->VALID_alertCode);
             $this->assertSame($pdoProductArray[$i]->getAlertFrequency(), $this->VALID_alertFrequency);
             $this->assertSame($pdoProductArray[$i]->getAlertPoint(), $this->VALID_alertPoint);
             $this->assertSame($pdoProductArray[$i]->getAlertOperator(), $this->VALID_alertOperator);
         } else {
             $this->assertSame($pdoProductArray[$i]->getProductId(), $this->product->getProductId());
             $this->assertSame($pdoProductArray[$i]->getVendorId(), $this->product->getVendorId());
             $this->assertSame($pdoProductArray[$i]->getDescription(), $this->product->getDescription());
             $this->assertSame($pdoProductArray[$i]->getSku(), $this->product->getSku());
             $this->assertSame($pdoProductArray[$i]->getTitle(), $this->product->getTitle());
         }
     }
 }
All Usage Examples Of Product::getTitle