zend_auth.php
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
class MyAuth_Adapter extends Zend_Auth_Adapter_DbTable
{
protected $customerColom = 'customer_id';
protected $customer;
public function __construct($dbAdapter)
{
parent::__construct($dbAdapter);
}
public function setCustomer($customer)
{
if (is_null($customer) || !is_string($customer)) {
throw new Adapter_Auth_Exception('Parameter ' .$customer. ' is leeg of is geen string');
}
$this->customer = $customer;
return $this;
}
public function getCustomerId()
{
$tableCustomer = new Table_Customer();
return $tableCustomer->getCustomerByName($this->customer); // of iets in die zin.
}
protected function _authenticateCreateSelect()
{
$select = parent::_authenticateCreateSelect();
$select->where(
$this->_zendDb->quoteIdentifier(
$this->customerColom, true
). '= ?', $this->getCustomerId()
);
return $select;
}
}
class MyAuth_Adapter extends Zend_Auth_Adapter_DbTable
{
protected $customerColom = 'customer_id';
protected $customer;
public function __construct($dbAdapter)
{
parent::__construct($dbAdapter);
}
public function setCustomer($customer)
{
if (is_null($customer) || !is_string($customer)) {
throw new Adapter_Auth_Exception('Parameter ' .$customer. ' is leeg of is geen string');
}
$this->customer = $customer;
return $this;
}
public function getCustomerId()
{
$tableCustomer = new Table_Customer();
return $tableCustomer->getCustomerByName($this->customer); // of iets in die zin.
}
protected function _authenticateCreateSelect()
{
$select = parent::_authenticateCreateSelect();
$select->where(
$this->_zendDb->quoteIdentifier(
$this->customerColom, true
). '= ?', $this->getCustomerId()
);
return $select;
}
}