public function getBillingAddress($actor=null)
    {
        if(is_null($actor)){
            $actor = $this->securityContext->getToken()->getUser();
            if (!$actor || !is_object($actor)) {
                throw new \LogicException(
                    'The getBillingAddress cannot be used without an authenticated user!'
                );
            }
        }
        /** @var Address $address */
        $address = $this->manager->getRepository('EcommerceBundle:Address')
            ->findOneBy(array(
                    'actor'       => $actor,
                    'forBilling' => true
                ));

        // if it does not exist, create a new one
        if (is_null($address)) {
            $address = new Address();
            $address->setForBilling(true);
            $country = $this->manager->getRepository('CoreBundle:Country')->find('es');
            $address->setCountry($country);
            $address->setActor($actor);
        }

        return $address;
    }
public function getBillingAddress($actor=null)
    {
        if(is_null($actor)){
            $actor = $this->securityContext->getToken()->getUser();
            if (!$actor || !is_object($actor)) {
                throw new \LogicException(
                    'The getBillingAddress cannot be used without an authenticated user!'
                );
            }
        }
        /** @var Address $address */
        $address = $this->manager->getRepository('EcommerceBundle:Address')
            ->findOneBy(array(
                    'actor'       => $actor,
                    'forBilling' => true
                ));

        // if it does not exist, create a new one
        if (is_null($address)) {
            $address = new Address();
            $address->setForBilling(true);
            $country = $this->manager->getRepository('CoreBundle:Country')->find('es');
            $address->setCountry($country);
            $address->setActor($actor);
        }

        return $address;
    }
public function getBillingAddress ( $ actor = null ) { if ( is_null ( $ actor ) ) { $ actor = $ this -> securityContext -> getToken ( ) -> getUser ( ) ; if ( ! $ actor || ! is_object ( $ actor ) ) { throw new \ LogicException ( 'The getBillingAddress cannot be used without an authenticated user!' ) ; } } /** @var Address $address */ $ address = $ this -> manager -> getRepository ( 'EcommerceBundle:Address' ) -> findOneBy ( array ( 'actor' => $ actor , 'forBilling' => true ) ) ; // if it does not exist, create a new one if ( is_null ( $ address ) ) { $ address = new Address ( ) ; $ address -> setForBilling ( true ) ; $ country = $ this -> manager -> getRepository ( 'CoreBundle:Country' ) -> find ( 'es' ) ; $ address -> setCountry ( $ country ) ; $ address -> setActor ( $ actor ) ; } return $ address ; }
Get billing address

@return Address
Get billing address