/
trait.php
64 lines (56 loc) · 1.58 KB
/
trait.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Created by PhpStorm.
* User: Ironman
* Date: 8/19/2015
* Time: 2:46 PM
*/
trait Sp4kAppsProductTrait
{
/** @var Sp4kTablesBase | Sp4kTablesNestedbase
protected $_table = false; */
protected $_key = 'id';
protected $_table_alias = 'product';
/**
* @return bool|\Sp4kTablesBase
*/
public function getTable()
{
return
$this->_table
?
$this->_table
:
$this->_table = new Sp4kTablesNestedbase('#__sp4k_product_items','id', $this->_table_alias);
}
public static function getInstance( Joomla\Registry\Registry $state = null)
{
return new self($state);
}
/**
* @param \Joomla\Registry\Registry | null $state
*
* @return \Sp4kAppsProductItem
*
*/
public function getItemInstance( Joomla\Registry\Registry $state = null)
{
return Sp4kAppsProductItem::getInstance( $state );
}
/**
* @param Joomla\Registry\Registry $state
*
* @return Sp4kAppsProductItems
*/
public function getItemsInstance( Joomla\Registry\Registry $state = NULL )
{
return Sp4kAppsProductItems::getInstance($state);
}
/**
* @return \Joomla\Registry\Registry
*/
protected function getState()
{
return Joomla\Registry\Registry::getInstance($this->_statekey);
}
}