Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateField DateTimeField Ошибка в autoNow => true #131

Closed
tsukasa-mixer opened this issue Mar 3, 2016 · 1 comment
Closed

DateField DateTimeField Ошибка в autoNow => true #131

tsukasa-mixer opened this issue Mar 3, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@tsukasa-mixer
Copy link

Не происходит автоматического обновления даты в поле при update если значение уже присутствует в модели.

Исправления:
Для DateTimeField

    public function getValue()
    {
        $db = ConnectionManager::getDb()->getQueryBuilder();

        if ($this->autoNowAdd && $this->getModel()->getIsNewRecord() || $this->autoNow) {
            return $db->convertToDateTime();
        }

        if ( is_numeric($this->value) ) {
            return $db->convertToDateTime($this->value);
        }

        return $this->value;
    }

Для DateField

    public function getValue()
    {
        $db = ConnectionManager::getDb()->getQueryBuilder();

        if ($this->autoNowAdd && $this->getModel()->getIsNewRecord() || $this->autoNow ) {
            return $db->convertToDate();
        }

        if ( is_numeric($this->value) ) {
            return $db->convertToDate($this->value);
        }

        return $this->value;
    }
@max107 max107 added the Bug label Mar 7, 2016
@max107 max107 self-assigned this Mar 7, 2016
@max107 max107 modified the milestone: 1.0 Jul 28, 2016
@max107
Copy link

max107 commented Jul 28, 2016

Исправлено в версии 2.0

@max107 max107 closed this as completed Jul 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants