src/Sulu/Bundle/ContactBundle/Controller/AccountController.php
protected function doPatch(AccountInterface $account, Request $request, ObjectManager $entityManager)
    {
        $accountManager = $this->getAccountManager();
        if (null !== $request->get('uid')) {
            $account->setUid($request->get('uid'));
        }
        if (null !== $request->get('registerNumber')) {
            $account->setRegisterNumber($request->get('registerNumber'));
        }
        if (null !== $request->get('number')) {
            $account->setNumber($request->get('number'));
        }
        if (null !== $request->get('placeOfJurisdiction')) {
            $account->setPlaceOfJurisdiction($request->get('placeOfJurisdiction'));
        }
        if (array_key_exists('id', $request->get('logo', []))) {
            $accountManager->setLogo($account, $request->get('logo')['id']);
        }
        if (null !== $request->get('medias')) {
            $accountManager->setMedias($account, $request->get('medias'));
        }

        // Check if mainContact is set
        if (null !== ($mainContactRequest = $request->get('mainContact'))) {
            $mainContact = $entityManager->getRepository(
                $this->container->getParameter('sulu.model.contact.class')
            )->find($mainContactRequest['id']);
            if ($mainContact) {
                $account->setMainContact($mainContact);
            }
        }

        // Process details
        if (null !== $request->get('bankAccounts')) {
            $accountManager->processBankAccounts($account, $request->get('bankAccounts', []));
        }
    }
protected function doPatch(AccountInterface $account, Request $request, ObjectManager $entityManager)
    {
        $accountManager = $this->getAccountManager();
        if (null !== $request->get('uid')) {
            $account->setUid($request->get('uid'));
        }
        if (null !== $request->get('registerNumber')) {
            $account->setRegisterNumber($request->get('registerNumber'));
        }
        if (null !== $request->get('number')) {
            $account->setNumber($request->get('number'));
        }
        if (null !== $request->get('placeOfJurisdiction')) {
            $account->setPlaceOfJurisdiction($request->get('placeOfJurisdiction'));
        }
        if (array_key_exists('id', $request->get('logo', []))) {
            $accountManager->setLogo($account, $request->get('logo')['id']);
        }
        if (null !== $request->get('medias')) {
            $accountManager->setMedias($account, $request->get('medias'));
        }

        // Check if mainContact is set
        if (null !== ($mainContactRequest = $request->get('mainContact'))) {
            $mainContact = $entityManager->getRepository(
                $this->container->getParameter('sulu.model.contact.class')
            )->find($mainContactRequest['id']);
            if ($mainContact) {
                $account->setMainContact($mainContact);
            }
        }

        // Process details
        if (null !== $request->get('bankAccounts')) {
            $accountManager->processBankAccounts($account, $request->get('bankAccounts', []));
        }
    }
protected function doPatch ( AccountInterface $ account , Request $ request , ObjectManager $ entityManager ) { $ accountManager = $ this -> getAccountManager ( ) ; if ( null !== $ request -> get ( 'uid' ) ) { $ account -> setUid ( $ request -> get ( 'uid' ) ) ; } if ( null !== $ request -> get ( 'registerNumber' ) ) { $ account -> setRegisterNumber ( $ request -> get ( 'registerNumber' ) ) ; } if ( null !== $ request -> get ( 'number' ) ) { $ account -> setNumber ( $ request -> get ( 'number' ) ) ; } if ( null !== $ request -> get ( 'placeOfJurisdiction' ) ) { $ account -> setPlaceOfJurisdiction ( $ request -> get ( 'placeOfJurisdiction' ) ) ; } if ( array_key_exists ( 'id' , $ request -> get ( 'logo' , [ ] ) ) ) { $ accountManager -> setLogo ( $ account , $ request -> get ( 'logo' ) [ 'id' ] ) ; } if ( null !== $ request -> get ( 'medias' ) ) { $ accountManager -> setMedias ( $ account , $ request -> get ( 'medias' ) ) ; } // Check if mainContact is set if ( null !== ( $ mainContactRequest = $ request -> get ( 'mainContact' ) ) ) { $ mainContact = $ entityManager -> getRepository ( $ this -> container -> getParameter ( 'sulu.model.contact.class' ) ) -> find ( $ mainContactRequest [ 'id' ] ) ; if ( $ mainContact ) { $ account -> setMainContact ( $ mainContact ) ; } } // Process details if ( null !== $ request -> get ( 'bankAccounts' ) ) { $ accountManager -> processBankAccounts ( $ account , $ request -> get ( 'bankAccounts' , [ ] ) ) ; } }
Process geiven entity for patch.

@param AccountInterface $account
@param Request $request
@param ObjectManager $entityManager
Process geiven entity for patch .