/**
  * Execute a request across all persistent stores and returns the results
  * if any
  *
  * @param MPersistentStoreRequest $request The request to be peformed
  *
  * @return MArray|null An Array containing the results for the request
  * or null if the request yields no results
  */
 public function executeRequest(MPersistentStoreRequest $request)
 {
     if ($this->persistentStores()->count() > 0) {
         if ($request->requestType() == MPersistentStoreRequest::SaveRequestType) {
             $objects = new MArray();
             foreach ($this->persistentStores()->toArray() as $persistentStore) {
                 $objects = $persistentStore->executeRequest($request);
             }
             return $objects;
         } else {
             if ($request->requestType() == MPersistentStoreRequest::FetchRequestType) {
                 return $this->persistentStores()->anyObject()->executeRequest($request);
             } else {
                 if ($request->requestType() == MPersistentStoreRequest::FaultRequestType) {
                     return $this->persistentStores()->anyObject()->executeRequest($request);
                 } else {
                     throw new MPersistentStoreException(Sf("Unsupported request type (%s)", $request->requestType()));
                 }
             }
         }
     } else {
         throw new MPersistentStoreException(S("No persistent stores defined!"));
     }
 }
 /**
  * This method executes a request in the Persistent Store and returns the
  * results as an Array
  *
  * @param MPersistentStoreRequest $request The Request to perform
  *
  * @return MArray An Array containing the results of the request
  */
 public function executeRequest(MPersistentStoreRequest $request)
 {
     $this->ensureDatabaseConsistency();
     if ($request->requestType() == MPersistentStoreRequest::FetchRequestType) {
         return $this->executeFetchRequest($request);
     } else {
         if ($request->requestType() == MPersistentStoreRequest::FaultRequestType) {
             return $this->executeFaultRequest($request);
         } else {
             if ($request->requestType() == MPersistentStoreRequest::SaveRequestType) {
                 return $this->executeSaveRequest($request);
             } else {
                 throw new MPersistentStoreException(S("Invalid request type"));
             }
         }
     }
 }