adapter() public static method

Returns adapter class name for given $name configuration, using the $_adapter path defined in Adaptable subclasses.
public static adapter ( string | null $name = null ) : object
$name string | null Class name of adapter to load.
return object Adapter object.
Exemplo n.º 1
0
 /**
  * Override adapter retrival by not storing the object
  *
  * @see lithium\core\Adaptable::adapter
  */
 public static function adapter($name = null)
 {
     $object = parent::adapter($name);
     // Do not store the mail created
     unset(static::$_configurations[$name][0]['object']);
     return $object;
 }
Exemplo n.º 2
0
 /**
  * Returns the adapter object instance of the named configuration.
  *
  * @param string $name Named configuration. If not set, the last configured
  *        adapter object instance will be returned.
  * @return object Adapter instance.
  */
 public static function adapter($name = null)
 {
     if (!$name) {
         if (!($names = array_keys(static::$_configurations))) {
             return;
         }
         $name = end($names);
     }
     return parent::adapter($name);
 }
Exemplo n.º 3
0
 public static function adapter($name = null)
 {
     if (empty($name)) {
         if (!($names = static::$_configurations->keys())) {
             return;
         }
         $name = end($names);
     }
     return parent::adapter($name);
 }