src/Sulu/Bundle/ContactBundle/Controller/AccountController.php
protected function doPost(Request $request)
    {
        $accountManager = $this->getAccountManager();
        $account = $this->get('sulu_contact.account_factory')->createEntity();
        $account->setName($request->get('name'));
        $account->setCorporation($request->get('corporation'));

        if (null !== $request->get('uid')) {
            $account->setUid($request->get('uid'));
        }

        if (null !== $request->get('note')) {
            $account->setNote($request->get('note'));
        }

        $logo = $request->get('logo', []);
        if ($logo && array_key_exists('id', $logo)) {
            $accountManager->setLogo($account, $request->get('logo')['id']);
        }

        $this->setParent($request->get('parent'), $account);

        $accountManager->processCategories($account, $request->get('categories', []));

        $account->setCreator($this->getUser());
        $account->setChanger($this->getUser());

        // Add urls, phones, emails, tags, bankAccounts, notes, addresses,..
        $accountManager->addNewContactRelations($account, $request->request->all());

        return $account;
    }
protected function doPost(Request $request)
    {
        $accountManager = $this->getAccountManager();
        $account = $this->get('sulu_contact.account_factory')->createEntity();
        $account->setName($request->get('name'));
        $account->setCorporation($request->get('corporation'));

        if (null !== $request->get('uid')) {
            $account->setUid($request->get('uid'));
        }

        if (null !== $request->get('note')) {
            $account->setNote($request->get('note'));
        }

        $logo = $request->get('logo', []);
        if ($logo && array_key_exists('id', $logo)) {
            $accountManager->setLogo($account, $request->get('logo')['id']);
        }

        $this->setParent($request->get('parent'), $account);

        $accountManager->processCategories($account, $request->get('categories', []));

        $account->setCreator($this->getUser());
        $account->setChanger($this->getUser());

        // Add urls, phones, emails, tags, bankAccounts, notes, addresses,..
        $accountManager->addNewContactRelations($account, $request->request->all());

        return $account;
    }
protected function doPost ( Request $ request ) { $ accountManager = $ this -> getAccountManager ( ) ; $ account = $ this -> get ( 'sulu_contact.account_factory' ) -> createEntity ( ) ; $ account -> setName ( $ request -> get ( 'name' ) ) ; $ account -> setCorporation ( $ request -> get ( 'corporation' ) ) ; if ( null !== $ request -> get ( 'uid' ) ) { $ account -> setUid ( $ request -> get ( 'uid' ) ) ; } if ( null !== $ request -> get ( 'note' ) ) { $ account -> setNote ( $ request -> get ( 'note' ) ) ; } $ logo = $ request -> get ( 'logo' , [ ] ) ; if ( $ logo && array_key_exists ( 'id' , $ logo ) ) { $ accountManager -> setLogo ( $ account , $ request -> get ( 'logo' ) [ 'id' ] ) ; } $ this -> setParent ( $ request -> get ( 'parent' ) , $ account ) ; $ accountManager -> processCategories ( $ account , $ request -> get ( 'categories' , [ ] ) ) ; $ account -> setCreator ( $ this -> getUser ( ) ) ; $ account -> setChanger ( $ this -> getUser ( ) ) ; // Add urls, phones, emails, tags, bankAccounts, notes, addresses,.. $ accountManager -> addNewContactRelations ( $ account , $ request -> request -> all ( ) ) ; return $ account ; }
Maps data from request to a new account.

@param Request $request

@throws EntityNotFoundException

@return AccountInterface
Maps data from request to a new account .