Skip to content

Persistence\Array_ not allowing zero id, throwing error #907

@mkrecek234

Description

@mkrecek234
  1. Create a model from an array with $m = new Model(new Array_($t)); where $t= [ ['name' => 'January', 'sales' => 20000, 'purchases' => 10000], ['name' => 'February', 'sales' => 23000, 'purchases' => 12000]]

  2. Iterate through model with foreach ($model as $row) { }

Atk4\Data throws an error on iteration as it does not accept id to be zero in \Atk4\Data\Field Line 311.

$value = (int) $value; if ($this->required && empty($value)) { throw new ValidationException([$this->name => 'Must not be a zero'], $this->getOwner()); }

@mvorisek Probably due to stricter type validation, but that way Persistence\Array_ is broken.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions