yii2-module / yii2-information
A module that processes atomic information units
Requires
- php: >=8.0
- php-extended/php-basic-console-logger: ^7
- php-extended/php-information-interface: ^18.4
- php-extended/php-information-object: ^18.4
- php-extended/php-multiple-logger: ^7
- yii2-extended/yii2-module-metadata-object: ^7
- yii2-extended/yii2-psr3-logger-bridge: ^7
- yii2-module/yii2-module-helper: ^7
- yiisoft/yii2: ^2
Requires (Dev)
- dev-master
- 7.0.5
- 7.0.4
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 6.0.8
- 6.0.7
- 6.0.6
- 6.0.5
- 6.0.4
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0.0
- 5.0.2
- 5.0.1
- 5.0.0
- 4.0.2
- 4.0.1
- 4.0.0
- 3.8.0
- 3.7.3
- 3.7.2
- 3.7.1
- 3.7.0
- 3.6.0
- 3.5.1
- 3.5.0
- 3.4.3
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.0
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.7
- 3.1.6
- 3.1.5
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2024-10-31 00:26:44 UTC
README
A module that processes atomic information units.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.phar
from their website. - Then run the following command to install this library as dependency :
php composer.phar install yii2-module/yii2-information ^7
Basic Usage
This module needs the following components to be set at the configuration level:
- 'db_information' should be a
\yii\db\Connection
If you already have a database connection, you may use the following trick :
'db_information' => function() { return \Yii::$app->get('db'); },
where 'db' is the id of your database connection.
This module needs the following parameters to be set at the configuration level:
- (none)
You should also modify the configuration of the yii application with the following changes :
[
...
'modules' => [
...
'information' => [
'class' => 'Yii2Module\Yii2Information\InformationModule',
],
...
],
...
]
Console API
The console API uses the following commands, assuming your working directory
is the directory where the yii (console) file is, and that the configuration
to this module has been named information
.
./yii information/process/delete-for-module --moduleId={{moduleId}}
This method deletes all informations related to the module with the given id in the informations tables.
./yii information/process/module --moduleId={{moduleId}}
This method resolves all the records that are stored in the information tables for the module with the given id.
./yii information/process/data --moduleId={{moduleId}}
This method resolves only the information data that are stored for the module with the given id.
./yii information/process/relation --moduleId={{moduleId}}
This method resolves only the information relation that are stored for the module with the given id.
PHP API
The php API, available in the InformationModule
component, is defined as
follow :
use PhpExtended\Information\InformationVisitorInterface;
use PhpExtended\Information\LoggerInformationVisitor;
use Psr\Log\LoggerInterface;
getStorageHandler(Module $module, LoggerInterface $logger, boolean $checkBeforeInsert = false) : InformationVisitorInterface
This method gets an information handler to handle all the informations that
could be thrown at it. If the $checkBeforeInsert
parameter is set to
true, then this method will decorate the handler with another handler which
checks in the current database if the information exists, and if it exists, it
will skip storing it. That handler will not check for accuracy of the information,
only its existence. This handler is more useful in a multi threaded environment
due to the fact it maximizes parallelization of resolving records.
use PhpExtended\Information\InformationVisitorInterface;
use PhpExtended\Information\LoggerInformationVisitor;
use Psr\Log\LoggerInterface;
getResolverHandler(Module $module, LoggerInterface $logger) : InformationVisitorInterface
This method gets an information handler to handle all the informations that
could be thrown at it. It will try to resolve it like all the other process
methods below, and if it cannot, it will store the record like the storage
handler up there. This handler is more useful in a single threaded environment
due to the fact it minimizes the number of queries to the database.
processForModule(Module $module, LoggerInterface $logger = null) : void
This method processes all kinds of information for given module. In this context, processing means resolving individual information context to be able to store all of those informations within a relational database which is tailored to handle them. All informations that couldn't be stored accordingly stay in the informations database.
deleteForModule(Module $module) : void
This method deletes all informations related to the given module in the informations tables.
processInformationData(Module $module, LoggerInterface $logger = null) : void
This method processes all the informations of type data for given module. Such
informations are assuming the receiving database holds a path
field in order
to store the information's primary key or identifier.
processInformationRelation(Module $module, LoggerInterface $logger = null) : void
This method processes all the informations of type relation for given module.
Such informations are assuming the receiving database holds a path
field in
order to store the information's primary key or identifier.
License
MIT. See license file.