ecom
E-commerce cms
Main Page
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
core
models
Meta.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Entity
;
4
5
class
Meta
extends
ModelBase
6
{
7
private
$entity
;
8
9
protected
function
install
()
10
{
11
$dbPrefix = $this->getDbPrefix();
12
$result = self::$dbo->exec(
"CREATE TABLE IF NOT EXISTS `{$dbPrefix}meta` (
13
`entity_id` INTEGER(11) UNSIGNED NOT NULL,
14
`entityType` VARCHAR(32) NOT NULL,
15
`lang` VARCHAR(8) NULL,
16
`key` VARCHAR(64) NOT NULL,
17
`value` TEXT NULL,
18
UNIQUE(`entity_id`, `entityType`, `lang`)
19
)"
);
20
if
($result ===
false
)
21
throw
new \Exception(get_class().
": "
.self::$dbo->errorInfo()[2]);
22
return
true
;
23
}
24
25
public
function
__get
($key)
26
{
27
if
($key ==
"entity"
)
28
return
$this->entity;
29
return
parent::__get($key);
30
}
31
32
public
function
__set
($key, $value)
33
{
34
if
($key ==
"entity"
)
35
{
36
parent::__set(
"entityId"
, $value->id);
37
parent::__set(
"entityType"
, get_class($value));
38
return
$value;
39
}
40
else
if
($key ==
"entityId"
|| $key ==
"entityType"
)
41
throw
new \Exception(
"Cannot access private field {$key}"
);
42
return
parent::__set($key, $value);
43
}
44
}
45
Entity\Meta
Definition:
Meta.php:5
Entity
Definition:
Address.php:3
Entity\Meta\$entity
$entity
Definition:
Meta.php:7
Entity\Meta\install
install()
Definition:
Meta.php:9
Entity\Meta\__get
__get($key)
Definition:
Meta.php:25
Entity\Meta\__set
__set($key, $value)
Definition:
Meta.php:32
Entity\ModelBase
Definition:
ModelBase.php:5
Generated on Sun Aug 16 2015 21:56:15 for ecom by
1.8.8