Newer
Older
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
# Class_Entity
## Description
In PHP we have StdClass on which we can set and get any direct property
```php
$o = new StdClass();
$o->title = 'my title';
echo $o->title; // -> my title
```
_Class_Entity_ provides same functionality with getter and setter methods
```php
$o = new Class_Entity();
$o->setTitle('my title');
echo $o->getTitle(); // -> my title
```
## Implementation
Any call to set*() will be catched to populate an internal key => value array, it will return $this to chain calls.
Any call to get*() will look for an existing key in internal array and will return its value or null if not found.
Keys of internal array are not transformed in any way
* setMyValue will produce a 'MyValue' key
* set_my_value will produce a '_my_value' key
* setmyvalue will produce a 'myvalue' key
You can define default values by setting
```php
protected $_attribs = ['MyValue' => ''];
```
Then a getMyValue() call will return an empty string instead of null if not set.
## Use cases
### In tests
When you have an API relying on getter and setter methods you can provide a _Class_Entity_ as a mock and easily verify that an attribute has been set or prepare it with attributes needed by tested code.
### In general
When you are modeling an object and don't want to write all those standard getters and setters just extend Class_Entity.
# ticket #22209
## Search result
Reification of the array returned by _Class_MoteurRecherche_ that contained queries for facets & record fetch. Now we have _Class_MoteurRecherche_Result_ that depends on search engine & search criterias. Noticeable methods:
* _recordsCollect($closure)_: for parsing all records. $closure must accept a record (_Class_Notice_).
* _acceptCriteresVisitor($visitor)_: for parsing search criterias
## Atom search feed generation
Add _ZendAfi_Feed_SearchResult_ as a _Class_MoteurRecherche_Result_ visitor that renders a search result as Atom feed.
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
# ticket #24821
## Notifications
In controllers, notifcations can be rendered as popup instead of static bars:
```php
$this->getHelper('notify')->bePopup()
```
_ZendAfi\_Controller\_Action\_Helper\_FlashMessenger_ notifications now stored as array and can accept parameters:
```php
public function addNotification($message, $options = []) {
$params = ['message' => $message] + $options;
$this->addMessage([ZendAfi_Controller_Action_Helper_FlashMessenger::NOTIFICATION => $params]);
}
```
and _FlashMessengerNotification_ represent a notification. For example to get all popups notifications:
```php
(new ZendAfi_Controller_Action_Helper_FlashMessenger())
->getNotifications()
->select(function($n) {return $n->isPopup();});
```
Users ILS subscription ('abonnement') related functions moved to new _Class\_User\_ILSSubscription_.
See _Class\_Users>>registerNotificationsOn_ for notifications usage.
## ILS Web services
Add _Class\_WebService\_SIGB\_Reservation>>isWaitingToBePulled_ that returns _true_ when holded document is available in library. Works for: Nanook, Koha, Microbib, Aloes, Carthame, Orphée, Pergame.
# Reload module content with AJAX
On module ajax link, add tag attributes: 'data-reload-module = true'.
For example:
```php
$this->view->tagAnchor($reload_link,
'',
['data-ajax-reload' => 'true',
'class' => 'reload-module',
'title' => $this->view->_('Recharger')]);
```
See public/opac/js/reload_module.js