Пример #1
0
 /**
  * @test
  */
 public function setByArray()
 {
     $cell = new Tx_PtExtlist_Domain_Model_List_Cell();
     $cell->setByArray($this->testDataArray);
     $this->assertEquals('testValue', $cell->getValue());
     $this->assertEquals('testCssClass', $cell->getCSSClass());
     $this->assertEquals(1, $cell->getRowIndex());
     $this->assertEquals(2, $cell->getColumnIndex());
     $this->assertEquals(array('key1' => 'value1'), $cell->getSpecialValues());
 }
Пример #2
0
 /**
  * Set Cell Data by array
  * Reuse the existing cell objects or create new.
  *
  * @param $rowArray
  */
 public function setByArray($rowArray)
 {
     $this->specialValues = isset($rowArray['specialValues']) ? $rowArray['specialValues'] : null;
     $newItemsArray = array();
     foreach ($rowArray['columns'] as $columnIdentifier => $cellData) {
         if (count($this->itemsArr)) {
             $cell = array_pop($this->itemsArr);
             /**  @var $cell Tx_PtExtlist_Domain_Model_List_Cell */
             $cell->setByArray($cellData);
         } else {
             $cell = new Tx_PtExtlist_Domain_Model_List_Cell();
             $cell->setByArray($cellData);
         }
         $newItemsArray[$columnIdentifier] = $cell;
     }
     unset($this->itemsArr);
     $this->itemsArr = $newItemsArray;
 }