services/NorthWind/NorthWindQueryProvider.php
/**
     * Serialize the sql row into Customer object
     * 
     * @param array $record each row of customer
     * 
     * @return object
     */
Serialize the sql row into Customer object

@param array $record each row of customer

@return object
Serialize the sql row into Customer object @param array $record each row of customer @return object
private function _serializeCustomer($record)
    {
        $customer = new Customer();
        $customer->CustomerID = $record['CustomerID'];
        $customer->CompanyName = $record['CompanyName'];
        $customer->ContactName = $record['ContactName'];
        $customer->ContactTitle = $record['ContactTitle'];
        $customer->Phone = $record['Phone'];
        $customer->Fax = $record['Fax'];        
        $customer->Address = new Address();
        $customer->Address->StreetName = ($record['Address']);
        $customer->Address->City = $record['City'];
        $customer->Address->Region = $record['Region'];
        $customer->Address->PostalCode = $record['PostalCode'];
        $customer->Address->Country = $record['Country'];
        $customer->Address->AltAddress = new Address();
        $customer->Address->AltAddress->StreetName = 'ALT_' . $customer->Address->StreetName;
        $customer->Address->AltAddress->City = 'ALT_' . $customer->Address->City;
        $customer->Address->AltAddress->Region = 'ALT_' . $customer->Address->Region;
        $customer->Address->AltAddress->PostalCode = 'ALT_' . $customer->Address->PostalCode;
        $customer->Address->AltAddress->Country = 'ALT_' . $customer->Address->Country;
        $customer->EmailAddresses = array();
        for ($i = 1; $i < 4; $i++) {
            $customer->EmailAddresses[] = $customer->CustomerID . $i . '@live.com'; 
        }
        $customer->OtherAddresses = array();
        for ($i = 0; $i < 2; $i++) {
            $customer->OtherAddresses[$i] = new Address();
            $this->_copyAddress($customer->Address, $customer->OtherAddresses[$i], $i + 1);
        }
        return $customer;
    }
private function _serializeCustomer ( $ record ) { $ customer = new Customer ( ) ; $ customer -> CustomerID = $ record [ 'CustomerID' ] ; $ customer -> CompanyName = $ record [ 'CompanyName' ] ; $ customer -> ContactName = $ record [ 'ContactName' ] ; $ customer -> ContactTitle = $ record [ 'ContactTitle' ] ; $ customer -> Phone = $ record [ 'Phone' ] ; $ customer -> Fax = $ record [ 'Fax' ] ; $ customer -> Address = new Address ( ) ; $ customer -> Address -> StreetName = ( $ record [ 'Address' ] ) ; $ customer -> Address -> City = $ record [ 'City' ] ; $ customer -> Address -> Region = $ record [ 'Region' ] ; $ customer -> Address -> PostalCode = $ record [ 'PostalCode' ] ; $ customer -> Address -> Country = $ record [ 'Country' ] ; $ customer -> Address -> AltAddress = new Address ( ) ; $ customer -> Address -> AltAddress -> StreetName = 'ALT_' . $ customer -> Address -> StreetName ; $ customer -> Address -> AltAddress -> City = 'ALT_' . $ customer -> Address -> City ; $ customer -> Address -> AltAddress -> Region = 'ALT_' . $ customer -> Address -> Region ; $ customer -> Address -> AltAddress -> PostalCode = 'ALT_' . $ customer -> Address -> PostalCode ; $ customer -> Address -> AltAddress -> Country = 'ALT_' . $ customer -> Address -> Country ; $ customer -> EmailAddresses = array ( ) ; for ( $ i = 1 ; $ i < 4 ; $ i ++ ) { $ customer -> EmailAddresses [ ] = $ customer -> CustomerID . $ i . '@live.com' ; } $ customer -> OtherAddresses = array ( ) ; for ( $ i = 0 ; $ i < 2 ; $ i ++ ) { $ customer -> OtherAddresses [ $ i ] = new Address ( ) ; $ this -> _copyAddress ( $ customer -> Address , $ customer -> OtherAddresses [ $ i ] , $ i + 1 ) ; } return $ customer ; }
Serialize the sql row into Customer object
Serialize the sql row into Customer object
//Set alternate address