Ejemplo n.º 1
0
 /**
  * @covers ByJG\AnyDataset\Repository\SingleRow::acceptChanges
  * @todo   Implement testAcceptChanges().
  */
 public function testAcceptChanges()
 {
     $this->fill();
     $this->object->setField('field2', 150);
     $this->assertEquals(array('field1' => array(10, 20, 30), 'field2' => 40), $this->object->getOriginalRawFormat());
     $this->object->acceptChanges();
     $this->assertEquals(array('field1' => array(10, 20, 30), 'field2' => 150), $this->object->getOriginalRawFormat());
 }
Ejemplo n.º 2
0
 /**
  * Append one row to AnyDataset.
  * @param SingleRow $sr
  * @return void
  */
 public function appendRow($sr = null)
 {
     if (!is_null($sr)) {
         if ($sr instanceof SingleRow) {
             $this->_collection[] = $sr;
             $sr->acceptChanges();
         } elseif (is_array($sr)) {
             $this->_collection[] = new SingleRow($sr);
         } else {
             throw new InvalidArgumentException("You must pass an array or a SingleRow object");
         }
     } else {
         $sr = new SingleRow();
         $this->_collection[] = $sr;
         $sr->acceptChanges();
     }
     $this->_currentRow = count($this->_collection) - 1;
 }