2014-10-22 19:59:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Auth;
|
|
|
|
|
|
|
|
use Core\Tool;
|
2014-12-22 19:15:38 +01:00
|
|
|
use Pimple\Container;
|
2014-10-22 19:59:09 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Base auth class
|
|
|
|
*
|
|
|
|
* @package auth
|
|
|
|
* @author Frederic Guillot
|
|
|
|
*
|
|
|
|
* @property \Model\Acl $acl
|
|
|
|
* @property \Model\LastLogin $lastLogin
|
|
|
|
* @property \Model\User $user
|
|
|
|
*/
|
|
|
|
abstract class Base
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Database instance
|
|
|
|
*
|
|
|
|
* @access protected
|
|
|
|
* @var \PicoDb\Database
|
|
|
|
*/
|
|
|
|
protected $db;
|
|
|
|
|
|
|
|
/**
|
2014-12-22 19:15:38 +01:00
|
|
|
* Container instance
|
2014-10-22 19:59:09 +02:00
|
|
|
*
|
|
|
|
* @access protected
|
2014-12-22 19:15:38 +01:00
|
|
|
* @var \Pimple\Container
|
2014-10-22 19:59:09 +02:00
|
|
|
*/
|
2014-12-22 19:15:38 +01:00
|
|
|
protected $container;
|
2014-10-22 19:59:09 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* @access public
|
2014-12-22 19:15:38 +01:00
|
|
|
* @param \Pimple\Container $container
|
2014-10-22 19:59:09 +02:00
|
|
|
*/
|
2014-12-22 19:15:38 +01:00
|
|
|
public function __construct(Container $container)
|
2014-10-22 19:59:09 +02:00
|
|
|
{
|
2014-12-22 19:15:38 +01:00
|
|
|
$this->container = $container;
|
|
|
|
$this->db = $this->container['db'];
|
2014-10-22 19:59:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load automatically models
|
|
|
|
*
|
|
|
|
* @access public
|
2014-12-22 19:15:38 +01:00
|
|
|
* @param string $name Model name
|
2014-10-22 19:59:09 +02:00
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function __get($name)
|
|
|
|
{
|
2014-12-22 19:15:38 +01:00
|
|
|
return Tool::loadModel($this->container, $name);
|
2014-10-22 19:59:09 +02:00
|
|
|
}
|
|
|
|
}
|