/** * Set column data * * @param string $columnName * @param mixed $value * @return $this * @throws Exception */ public function setValue($columnName, $value) { if ($this->structure && !$this->structure->hasField($columnName)) { throw new Exception("Collection Structure does not contain field {$columnName}"); } foreach ($this->data as $item) { $item->setValue($columnName, $value); } return $this; }
/** * Set column value * * @param string $columnName * @param mixed $value * @return $this * @throws Exception */ public function setValue($columnName, $value) { if ($this->structure && !$this->structure->hasField($columnName)) { throw new Exception("Record structure does not contain field {$columnName}"); } $this->data[$columnName] = $value; return $this; }
public function testNotHasField() { $this->assertFalse($this->structure->hasField('new_name')); }