Exemple #1
0
 /**
  * Set the One_Store used for the scheme
  *
  * @param One_Scheme $scheme
  * @param DOMXPath $xpath
  * @param DOMElement $meta
  */
 protected static function setConnection(One_Scheme $scheme, DOMXPath $xpath, DOMElement $meta)
 {
     $connectionSpec = $xpath->query($meta->getNodePath() . '/connection');
     if ($connectionSpec->length > 0) {
         $connection = $connectionSpec->item(0);
         $connectionName = trim($connection->getAttribute('name'));
         if ($connectionName != '') {
             $scheme->setConnection(One_Repository::getConnection($connectionName));
             $connectionAtts = array();
             $allAttributes = $connection->attributes;
             for ($i = 0; $i < $allAttributes->length; $i++) {
                 $connectionAtt = $allAttributes->item($i);
                 $connectionAtts[$connectionAtt->name] = $connectionAtt->value;
             }
             // Set resources as an array, because this is not necesarily the same for different stores
             // EG: mysql has a table attribute, SugarCRM has module
             $scheme->setResources($connectionAtts);
         }
     }
 }