setTable('inmobiliarias_nubox'); } public function create(?array $data = null): Model\Nubox { $map = (new Implement\Repository\MapperParser(['usuario', 'alias'])) ->register('inmobiliaria_rut', (new Implement\Repository\Mapper()) ->setProperty('inmobiliaria') ->setFunction(function(array $data) { return $this->inmobiliariaRepository->fetchById($data['inmobiliaria_rut']); })) ->register('contraseña', (new Implement\Repository\Mapper()) ->setProperty('password')); return $this->parseData(new Model\Nubox(), $data, $map); } public function save(Define\Model $model): Model\Nubox { $this->saveNew( ['inmobiliaria_rut', 'alias', 'usuario', 'contraseña'], [$model->inmobiliaria->rut, $model->alias, $model->usuario, $model->password] ); return $model; } public function edit(Define\Model $model, array $new_data): Model\Nubox { return $this->update($model, ['inmobiliaria_rut', 'alias', 'usuario', 'contraseña'], $new_data); } public function fetchByInmobiliaria(int $inmobiliaria_rut): Model\Nubox { $query = $this->connection->getQueryBuilder() ->select() ->from($this->getTable()) ->where('inmobiliaria_rut = ?'); return $this->fetchOne($query, [$inmobiliaria_rut]); } protected function getKey(): string { return 'inmobiliaria_rut'; } }