Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

won't update last activity #20

Closed
Adnan0703 opened this issue Aug 1, 2015 · 3 comments
Closed

won't update last activity #20

Adnan0703 opened this issue Aug 1, 2015 · 3 comments
Labels

Comments

@Adnan0703
Copy link

This method doesn't do anything.

public function updateLastActivity($userId = null, $field = 'last_action', $options = []) {
        $options = Hash::merge($this->_config['updateLastActivity'], $options);
        if ($this->_table->exists([$this->_table->alias() . '.' . $this->_table->primaryKey()])) {
            return $this->_table->updateAll(
                [$field => date($options['dateFormat'])],
                [$this->_table->primaryKey() => $userId]
            );
        }
        return false;
    }

This is the reason.
$this->_table->exists([$this->_table->alias() . '.' . $this->_table->primaryKey()])

@burzum
Copy link
Owner

burzum commented Aug 3, 2015

Could you please verify that by an unit test? There is already a test and it passes. I don't see what's wrong with the line you pasted?

@burzum burzum added the bug label Aug 3, 2015
@Adnan0703
Copy link
Author

No condition/value is being passed to exists.
[$this->_table->alias() . '.' . $this->_table->primaryKey()] will become something like ['Users.id']. Shouldn't it be like ['Users.id' => 1].

@burzum
Copy link
Owner

burzum commented Aug 4, 2015

Meh, true, you're right, it's fixed. Please let me know if you encounter more problems.

@burzum burzum closed this as completed Aug 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants