Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 856 Bytes

README.md

File metadata and controls

41 lines (31 loc) · 856 Bytes

Phalcon\Traits

Here is a collection of Traits that are often used or can be useful in everyday Phalcongelist life.

Phalcon\Traits\ConfigurableTrait

Allows to define parameters which can be set by passing them to the class constructor. These parameters should be defined in the $configurable array.

use Phalcon\Traits\ConfigurableTrait;

class MyAdapter
{
    use ConfigurableTrait;
    
    protected $host;
    protected $viewsDir;
    protected $protectedParameter;
    
    protected $configurable = [
        'host',
        'viewsDir'
    ];
    
    public function __construct(array $options)
    {
        $this->setConfig($config);
    }
    
    protected function setHost($host)
    {
        $this->host = $host;
    }
    
    protected function setViewsDir($viewsDir)
    {
        $this->viewsDir = $viewsDir;
    }
}