Error: Call to a member function setStats() on a non-object

Error: Call to a member function setStats() on a non-object

我正在尝试更新我的实体 class 中的单个数据,但学说总是返回此错误

Error: Call to a member function setStats() on a non-object**
        $em = $this->getDoctrine()->getManager();

        $result = $em->getRepository('MyBundle:UserStats')->findBy(array('ownerPhone' => 1002));

        if( isset($result) && $result !== false ) {
        echo $result->setConditionState(0); // ConditionState is a boolean condition which i want to set it to false

        }
        $em->flush();

我的实体 class for conditionState---

/**
     * Set conditionState
     *
     * @param boolean $conditionState
     *
     * @return UserStats
     */
    public function setConditionState($conditionState)
    {
        $this->conditionState = $conditionState;

        return $this;
    }

    /**
     * Get conditionState
     *
     * @return boolean
     */
    public function getConditionState()
    {
        return $this->conditionState;
    }

有谁知道我在哪里犯了错误吗?

findBy 方法 returns 数组。请改用 findOneBy