File tree Expand file tree Collapse file tree 4 files changed +15
-9
lines changed Expand file tree Collapse file tree 4 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 10
10
}
11
11
],
12
12
"require" : {
13
- "php" : " >=5.3.2" ,
14
- "nette/nette" : " ~2.1@dev"
13
+ "php" : " >=5.4" ,
14
+ "nette/utils" : " ~2.2" ,
15
+ "nette/forms" : " ~2.2" ,
16
+ "nette/application" : " ~2.2"
15
17
},
16
18
"autoload" : {
17
19
"psr-4" : {
Original file line number Diff line number Diff line change 6
6
*/
7
7
class Form extends \Nette \Application \UI \Form implements IFormWithMapper
8
8
{
9
+
9
10
use TFormWithMapper;
10
11
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
namespace Librette \Forms ;
3
3
4
+ use Nette ;
4
5
use Nette \Forms \IFormRenderer ;
5
6
use Nette \Localization \ITranslator ;
6
- use Nette ;
7
7
8
8
/**
9
9
* @author David Matejka
Original file line number Diff line number Diff line change 4
4
use Nette \Application \UI \Presenter ;
5
5
use Nette \ComponentModel \IComponent ;
6
6
7
+ /**
8
+ * @author David Matejka
9
+ */
7
10
trait TFormWithMapper
8
11
{
9
12
10
13
/** @var array of callbacks invoked before onSuccess callback */
11
- public $ onBeforeSuccess = array () ;
14
+ public $ onBeforeSuccess = [] ;
12
15
13
16
/** @var array of callbacks invoked after onSuccess callback */
14
- public $ onAfterSuccess = array () ;
17
+ public $ onAfterSuccess = [] ;
15
18
16
19
/** @var array of callbacks invoked right before mapper loads data */
17
- public $ onLoad = array () ;
20
+ public $ onLoad = [] ;
18
21
19
22
/** @var array of callbacks invoked right after mapper loads data */
20
- public $ onAfterLoad = array () ;
23
+ public $ onAfterLoad = [] ;
21
24
22
25
/** @var array of callbacks invoked when form is attached to presenter */
23
- public $ onAttached = array () ;
26
+ public $ onAttached = [] ;
24
27
25
28
/** @var IMapper */
26
29
protected $ mapper ;
@@ -29,7 +32,7 @@ trait TFormWithMapper
29
32
public function fireEvents ()
30
33
{
31
34
$ originalOnSuccess = $ this ->onSuccess ;
32
- $ this ->onSuccess = array () ;
35
+ $ this ->onSuccess = [] ;
33
36
$ this ->onSuccess [] = function () use ($ originalOnSuccess ) {
34
37
$ events = [];
35
38
$ events [] = $ this ->onBeforeSuccess ;
You can’t perform that action at this time.
0 commit comments