A module that processes atomic information units


Keywords
module, yii, information, yii2
License
MIT

Documentation

yii2-information

A module that processes atomic information units.

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	
	"require": {
		"yii2-module/yii2-information": "~1"
	}
	

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

You should also modify the configuration of the yii application with the following changes :

[
	'components' => [
		'db-yii2-module-yii2-information' => require __DIR__ . '/db-yii2-module-yii2-information.php',
	],
	'modules' => [
		'information' => [
			'class' => 'Yii2Module\Yii2Information\HttpInformation',
		]
	]
]

If you already have a db component and the http cache table is in the same database and schema, you can reference the db-yii2-module-yii2-information component with the following configuration :

[
	'components' => [
		'db-yii2-module-yii2-information' => function() { return \Yii::$app->get('db'); },
	]
]

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 informationDataTimed --moduleId={{moduleId}}

This method resolves only the information data timed 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.

./yii information/process/relation-timed --moduleId={{moduleId}}

This method resolves only the information relation timed that are stored for the module with the given id.

./yii information/process/relation-data --moduleId={{moduleId}}

This method resolves only the information relation data that are stored for the module with the given id.

./yii information/process/relation-data-timed --moduleId={{moduleId}}

This method resolves only the information relation data timed that are stored for the module with the given id.

./yii information/process/composite-timed --moduleId={{moduleId}}

This method resolves only the information composite timed that are stored for the module with the given id.

./yii information/process/composite-data --moduleId={{moduleId}}

This method resolves only the information composite data that are stored for the module with the given id.

./yii information/process/composite-data-timed --moduleId={{moduleId}}

This method resolves only the information composite data timed that are stored for the module with the given id.

./yii information/process/composite-relation --moduleId={{moduleId}}

This method resolves only the information composite relation that are stored for the module with the given id.

./yii information/process/composite-relation-timed --moduleId={{moduleId}}

This method resolves only the information composite relation timed 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;

InformationVisitorInterface getStorageHandler(Module $module, LoggerInterface $logger, boolean $checkBeforeInsert = false);

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;

InformationVisitorInterface getResolverHandler(Module $module, LoggerInterface $logger);

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.

void processForModule(Module $module, LoggerInterface $logger = null);

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.

void deleteForModule(Module $module);

This method deletes all informations related to the given module in the informations tables.

void processInformationData(Module $module, LoggerInterface $logger = null);

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.

void processInformationDataTimed(Module $module, LoggerInterface $logger = null);

This method processes all the informations of type data timed 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.

void processInformationRelation(Module $module, LoggerInterface $logger = null)

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.

void processInformationRelationTimed(Module $module, LoggerInterface $logger = null)

This method processes all the informations of type relation timed 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.

void processInformationRelationData(Module $module, LoggerInterface $logger = null)

This method processes all the informations of type relation 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.

void processInformationRelationDataTimed(Module $module, LoggerInterface $logger = null)

This method processes all the informations of type relation data timed 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.

void processInformationCompositeTimed(Module $module, LoggerInterface $logger = null)

This method processes all the informations of type composite timed 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.

void processInformationCompositeData(Module $module, LoggerInterface $logger = null)

This method processes all the informations of type composite 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.

void processInformationCompositeDataTimed(Module $module, LoggerInterface $logger = null)

This method processes all the informations of type composite data timed 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.

void processInformationCompositeRelation(Module $module, LoggerInterface $logger = null)

This method processes all the informations of type composite 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.

void processInformationCompositeRelationTimed(Module $module, LoggerInterface $logger = null)

This method processes all the informations of type composite relation timed 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.