Skip to content

Zend TableGateway can't execute 2 consecutive query #39

Open
@aditbisa

Description

@aditbisa

Hi Guys,

Firtsly, I'm sorry if I miss placed the question. After weeks learning the framework with this skeleton, I just desperate facing this issue.

It seems I can't run 2 consecutive query using TableGateway. It's always produce (not just UPDATE):

"Statement couldn't be produced with sql: UPDATE `users` SET `last_access` = NOW() WHERE `id` = ?"

Here's the code inside ZendUserRepository:

...
    public function footprint(int $id): void {
        $data = ['last_access' => new Predicate\Expression('NOW()')];
        $where = ['id' => $id];
        $this->table->update($data, $where);
    }
    
    public function authenticate(string $username, string $password): bool {
        $where = [
            'username' => $username,
            new Predicate\IsNotNull('roles')
        ];
        $rowset = $this->table->select($where);
        if (null === $row = $rowset->current()) {
            return false;
        }
        $data = (array) $row;
        if(password_verify($password, $data['password'])) {
            $this->footprint($data['id']);
            return true;
        }
        return false;
    }
...

Please, kindly help this newbie here.

Best Regards,
Adit

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions