示例#1
0
 /**
  * Gets a constructed provider.
  *
  * @param string $name
  *
  * @return Provider
  *
  * @since 2.0
  */
 public function get($name)
 {
     // Return the provider if it has already been constructed
     if (isset($this->providers[$name])) {
         return $this->providers[$name];
     }
     $config = $this->providerConfigs[$name];
     $provider = new Provider();
     $provider->setFactory($this);
     $provider->setProperties($config['properties']);
     $provider->setTableName($config['tableName']);
     // Assign any relations we might have.
     $this->assignRelationsToProvider($name, $config['relations'], $provider);
     // Assign a query builder if we have one
     if ($this->queryBuilder !== null) {
         $provider->setQueryBuilder($this->queryBuilder);
     }
     $this->providers[$name] = $provider;
     return $provider;
 }