Phosphorum\Models\PostsReplies::beforeCreate PHP Method

beforeCreate() public method

public beforeCreate ( )
    public function beforeCreate()
    {
        if ($this->in_reply_to_id > 0) {
            $postReplyTo = self::findFirst(['id = ?0', 'bind' => [$this->in_reply_to_id]]);
            if (!$postReplyTo) {
                $this->in_reply_to_id = 0;
            } elseif ($postReplyTo->posts_id != $this->posts_id) {
                $this->in_reply_to_id = 0;
            }
        }
        $this->accepted = 'N';
    }