fecha = new DateTimeImmutable($value); return $this; } protected function getKey(): string { return 'fecha'; } public function create(?array $data = null): Model\UF { $map = (new Implement\Repository\MapperParser(['valor'])) ->register('fecha', new Implement\Repository\Mapper\DateTime('fecha')); return $this->parseData(new Model\UF(), $data, $map); } public function save(Define\Model $model): Model\UF { $this->saveNew(['fecha', 'valor'], [ $model->fecha->format('Y-m-d'), $model->valor ]); return $model; } public function edit(Define\Model $model, array $new_data): Model\UF { return $this->update($model, ['fecha', 'valor'], $new_data); } /** * @param DateTimeInterface $dateTime * @return Model\UF * @throws Implement\Exception\EmptyResult */ public function fetchByFecha(DateTimeInterface $dateTime): Model\UF { $query = $this->connection->getQueryBuilder() ->select() ->from($this->getTable()) ->where('fecha = :fecha'); return $this->fetchOne($query, ['fecha' => $dateTime->format('Y-m-d')]); } }