odata/services/IDataServiceQueryProvider Implementation/NorthWind/NorthWindQueryProvider.php
/**
     * Serialize the sql row into Employee object
     * 
     * @param array $record each row of employee
     * 
     * @return Object
     */
Serialize the sql row into Employee object

@param array $record each row of employee

@return Object
Serialize the sql row into Employee object @param array $record each row of employee @return Object
private function _serializeEmployee($record)
    {
        $employee = new Employee();
        $employee->EmployeeID = $record['EmployeeID'];
        $employee->FirstName = $record['FirstName'];
        $employee->LastName = $record['LastName'];
        $employee->Title = $record['Title'];
        $employee->TitleOfCourtesy = $record['TitleOfCourtesy'];
        $employee->BirthDate = !is_null($record['BirthDate']) ? $record['BirthDate']->format('Y-m-d\TH:i:s'): null;
        $employee->HireDate = !is_null($record['HireDate']) ? $record['HireDate']->format('Y-m-d\TH:i:s'): null;        
        $employee->Address = $record['Address'];
        $employee->City = $record['City'];
        $employee->Region = $record['Region'];
        $employee->PostalCode = $record['PostalCode'];
        $employee->Country = $record['Country'];
        $employee->HomePhone = $record['HomePhone'];
        $employee->Extension = $record['Extension'];
        $employee->Notes = $record['Notes'];
        $employee->ReportsTo = $record['ReportsTo'];
        $employee->Emails = array ($employee->FirstName . '@hotmail.com', $employee->FirstName . '@live.com');
        return $employee;
    }
private function _serializeEmployee ( $ record ) { $ employee = new Employee ( ) ; $ employee -> EmployeeID = $ record [ 'EmployeeID' ] ; $ employee -> FirstName = $ record [ 'FirstName' ] ; $ employee -> LastName = $ record [ 'LastName' ] ; $ employee -> Title = $ record [ 'Title' ] ; $ employee -> TitleOfCourtesy = $ record [ 'TitleOfCourtesy' ] ; $ employee -> BirthDate = ! is_null ( $ record [ 'BirthDate' ] ) ? $ record [ 'BirthDate' ] -> format ( 'Y-m-d\TH:i:s' ) : null ; $ employee -> HireDate = ! is_null ( $ record [ 'HireDate' ] ) ? $ record [ 'HireDate' ] -> format ( 'Y-m-d\TH:i:s' ) : null ; $ employee -> Address = $ record [ 'Address' ] ; $ employee -> City = $ record [ 'City' ] ; $ employee -> Region = $ record [ 'Region' ] ; $ employee -> PostalCode = $ record [ 'PostalCode' ] ; $ employee -> Country = $ record [ 'Country' ] ; $ employee -> HomePhone = $ record [ 'HomePhone' ] ; $ employee -> Extension = $ record [ 'Extension' ] ; $ employee -> Notes = $ record [ 'Notes' ] ; $ employee -> ReportsTo = $ record [ 'ReportsTo' ] ; $ employee -> Emails = array ( $ employee -> FirstName . '@hotmail.com' , $ employee -> FirstName . '@live.com' ) ; return $ employee ; }
Serialize the sql row into Employee object
Serialize the sql row into Employee object
//$employee->Photo = $record['Photo'];