Commit ea6869e 1 parent 25360b5 commit ea6869e Copy full SHA for ea6869e
File tree 5 files changed +66
-1
lines changed
5 files changed +66
-1
lines changed Original file line number Diff line number Diff line change 38
38
"contributte/monolog" : " ^0.5" ,
39
39
"cweagans/composer-patches" : " ^1.7" ,
40
40
"doctrine/orm" : " 2.15.*" ,
41
+ "fastybird/datetime-factory" : " ^0.6" ,
41
42
"fastybird/metadata-library" : " dev-main" ,
42
43
"fastybird/simple-auth" : " ^0.14" ,
44
+ "ipub/doctrine-timestampable" : " ^2.0" ,
43
45
"nette/bootstrap" : " ^3.1" ,
44
46
"nette/application" : " ^3.1" ,
45
47
"nette/di" : " ^3.0" ,
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ extensions:
21
21
# contributteCacheDebug : Contributte\Cache\DI\DebugStorageExtension
22
22
orisaiObjectMapper : OriNette\ObjectMapper\DI\ObjectMapperExtension
23
23
fbApplicationLibrary : FastyBird\Library\Application\DI\ApplicationExtension
24
+ fbDateTimeFactory : FastyBird\DateTimeFactory\DI\DateTimeFactoryExtension
24
25
25
26
# #################################
26
27
# Nette extensions configuration #
Original file line number Diff line number Diff line change 21
21
use FastyBird \Library \Application \Router ;
22
22
use FastyBird \Library \Application \Subscribers ;
23
23
use FastyBird \Library \Application \UI ;
24
+ use FastyBird \Library \Application \Utilities ;
24
25
use Monolog ;
25
26
use Nette ;
26
27
use Nette \Bootstrap ;
@@ -236,6 +237,13 @@ public function loadConfiguration(): void
236
237
237
238
$ builder ->addDefinition ($ this ->prefix ('ui.routes ' ), new DI \Definitions \ServiceDefinition ())
238
239
->setType (Router \AppRouter::class);
240
+
241
+ /**
242
+ * Utilities
243
+ */
244
+
245
+ $ builder ->addDefinition ($ this ->prefix ('utilities.doctrineDateProvider ' ), new DI \Definitions \ServiceDefinition ())
246
+ ->setType (Utilities \DateTimeProvider::class);
239
247
}
240
248
241
249
/**
Original file line number Diff line number Diff line change 7
7
* @copyright https://www.fastybird.com
8
8
* @author Adam Kadlec <adam.kadlec@fastybird.com>
9
9
* @package FastyBird:ApplicationLibrary!
10
- * @subpackage Caching
10
+ * @subpackage UI
11
11
* @since 1.0.0
12
12
*
13
13
* @date 08.03.20
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ /**
4
+ * TemplateFactory.php
5
+ *
6
+ * @license More in LICENSE.md
7
+ * @copyright https://www.fastybird.com
8
+ * @author Adam Kadlec <adam.kadlec@fastybird.com>
9
+ * @package FastyBird:ApplicationLibrary!
10
+ * @subpackage Utilities
11
+ * @since 1.0.0
12
+ *
13
+ * @date 29.08.24
14
+ */
15
+
16
+ namespace FastyBird \Library \Application \Utilities ;
17
+
18
+ use DateTimeInterface ;
19
+ use FastyBird \DateTimeFactory ;
20
+ use IPub \DoctrineTimestampable \Providers as DoctrineTimestampableProviders ;
21
+ use Nette \DI ;
22
+
23
+ /**
24
+ * Date provider for doctrine timestampable
25
+ *
26
+ * @package FastyBird:ApplicationLibrary!
27
+ * @subpackage Subscribers
28
+ *
29
+ * @author Adam Kadlec <adam.kadlec@fastybird.com>
30
+ */
31
+ readonly class DateTimeProvider implements DoctrineTimestampableProviders \DateProvider
32
+ {
33
+
34
+ public function __construct (private DI \Container $ container )
35
+ {
36
+ }
37
+
38
+ /**
39
+ * @throws DI\MissingServiceException
40
+ */
41
+ public function getDate (): DateTimeInterface
42
+ {
43
+ return $ this ->container ->getByType (DateTimeFactory \Factory::class)->getNow ();
44
+ }
45
+
46
+ /**
47
+ * @throws DI\MissingServiceException
48
+ */
49
+ public function getTimestamp (): int
50
+ {
51
+ return $ this ->container ->getByType (DateTimeFactory \Factory::class)->getNow ()->getTimestamp ();
52
+ }
53
+
54
+ }
You can’t perform that action at this time.
0 commit comments