1 | <?php |
||
12 | class SessionProfileStorage implements IProfileStorage |
||
13 | { |
||
14 | use SmartObject; |
||
15 | |||
16 | const SESSION_SECTION = 'SixtyEightPublishers.Application'; |
||
17 | |||
18 | /** @var null|ActiveProfile */ |
||
19 | private $profile; |
||
20 | |||
21 | /** @var \Nette\Http\SessionSection */ |
||
22 | private $session; |
||
23 | |||
24 | /** @var null|callable */ |
||
25 | public $onPersist; |
||
26 | |||
27 | /** @var null|callable */ |
||
28 | public $onProfileSet; |
||
29 | |||
30 | /** |
||
31 | * @param \Nette\Http\Session $session |
||
32 | */ |
||
33 | public function __construct(Session $session) |
||
37 | |||
38 | |||
39 | /***************** interface \SixtyEightPublishers\Application\IProfileStorage *****************/ |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function setProfile(IProfile $profile) |
||
67 | |||
68 | /** |
||
69 | * @return \SixtyEightPublishers\Application\ActiveProfile |
||
70 | */ |
||
71 | public function getProfile() : ActiveProfile |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function persist() |
||
87 | } |
||
88 |