-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathreadme-taxonomy.txt
104 lines (87 loc) · 2.94 KB
/
readme-taxonomy.txt
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Architecture and API Design for Taxonomy and Channel Mechanism
Term
Aggregator – Channel or column to aggregate contents from various providers
Provider – Modules to provide contents for aggregator
Taxonomy – Global structural data schema for contents between aggregator and provider
Abbreviation
S – Structural schema
E – Entity
R – Relation
Provider (E) <----> Aggregator (R) <---- Taxonomy (S)
APIs - Taxonomy
For aggregator
get -> model
getTree: array/nested
getList: array
More
@see Pi\Application\Service\Taxonomy
APIs - Aggregator
Global
add: name, title (, slug, theme) -> bool
update: name, title (, slug, theme) -> bool
get: name -> array
has: name -> bool
delete: name -> bool
setTheme: name, themeName -> bool
getTheme: name -> string
getList -> array
getUri: name -> string
Page related
addPage: name, title, type, channel (, provider, slug, cache, access, layout) -> bool
updatePage: name, title (, slug, cache, access, layout) -> bool
deletePage: name -> bool
Provider related
addProvider: name, title, slug [, meta] -> bool
upateProvider: name, title, slug [, meta] -> bool
hasProvider: name -> bool
getProvider: name -> array
getProviders -> array
Taxon/Channel related
getTaxonomy -> tree
hasTaxon: name -> bool
getTaxon: name -> array
getTaxonUri: name -> string
Entity related
hasEntity: module, [id (, category)] -> bool
getEntity: module, [id, (, category)] -> array
addEntity: taxon, module, [id, (, category)], (, slug, time) -> bool
updateEntity: module, [id, (, category)] (, slug, time) -> bool
deleteEntity: module, [id, (, category)] -> bool
getUri: module, [id, (, category)] -> string:uri
hasPush: taxon, module, [id, (, category)] -> bool
getPushes: module, [id, (, category)] -> array
addPush: taxon, module, [id, (, category)] -> bool
updatePush: taxon, module, [id, (, category)] (, slug) -> bool
deletePush: taxon, module, [id, (, category)] -> bool
APIs - Provider
For aggregator
isActive -> bool
hasEntity: id -> bool
getEntity: id -> array
getList: id[](, fields[]) -> array
renderEntity: id (, template) -> string
renderList: id[] (, template) -> string
Taiwen Jiang
October 22nd, 2012
Attachment:
<?php
namespace Module\Provider\Api;
use Pi\Application\Api\AbstractProvider;
class Provider extends AbstractProvider
{
public function renderEntity($id, $template = '')
{
if (!$template) {
$template = '...';
}
$model = Pi::model('provider', $this->module);
$row = $model->find($id);
$viewModel = $this->getViewModel($row->toArray());
$viewModel->setTemplate($template);
$content = $this->getRenderer()->render($viewModel);
return $content;
}
}
<?php
$providerHandler = Pi::api('provider', 'provider');
$entityContent = $providerHandler->renderEntity($id);