Esempio n. 1
0
    /**
     * Cria um novo usuário no mongo
     * 
     * @param Nidorx_Model_Vo_User $voUserProfile
     * @return Nidorx_Bridge_Output 
     */
    public function save(Nidorx_Model_Vo_User_Profile &$voUserProfile)
    {
        $profileBd = null;
        if ($voUserProfile->id) {
            //Se já existir o id, está editando
            $profileBd = $this->getByUserId($voUserProfile->userId, false);
            $profileBd->setFromArray($voUserProfile->toArray(true, true));
        } else {
            //Está criando o usuaŕio
            $profileBd = $this->createRow($voUserProfile->toArray(true, true));
        }


        //Finalmente salva os dados
        if ($profileBd->save()) {
            $voUser->id = $profileBd->id;
            return true;
        };

        return false;
    }