Adds documentation.

This commit is contained in:
Vassyli
2018-01-06 09:25:07 +01:00
parent ff713ac333
commit 45a785a8f5
5 changed files with 31 additions and 1 deletions
+3
View File
@@ -210,6 +210,9 @@ class Bootstrap
}
}
/**
* Runs the code to extend models.
*/
public function extendModels()
{
AnnotationRegistry::registerLoader("class_exists");
@@ -17,11 +17,19 @@ class EntityPostLoadEventListener
/** @var Game $game */
private $game;
/**
* EntityPostLoadEventListener constructor.
* @param Game $g
*/
public function __construct(Game $g)
{
$this->game = $g;
}
/**
* Called upon event postLoad.
* @param LifecycleEventArgs $args
*/
public function postLoad(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
+1 -1
View File
@@ -124,7 +124,7 @@ class LibraryConfiguration
/**
* Returns a subkey if it exists or null.
* @param array $arguments
* @return type
* @return mixed
*/
public function getSubKeyIfItExists(array $arguments)
{
+15
View File
@@ -10,11 +10,20 @@ use ReflectionClass;
use Doctrine\Common\Annotations\AnnotationReader;
use LotGD\Core\Doctrine\Annotations\Extension;
/**
* Contains method to help the extension of a model.
* @package LotGD\Core
*/
class ModelExtender
{
/** @var AnnotationReader */
private $reader;
/** @var array */
private static $classes = [];
/**
* ModelExtender constructor.
*/
public function __construct()
{
$this->reader = new AnnotationReader();
@@ -65,6 +74,12 @@ class ModelExtender
}
}
/**
* Returns a callback registered in the model extender globally.
* @param string $modelClassName
* @param string $methodName
* @return callable|null
*/
public static function get(string $modelClassName, string $methodName): ?callable
{
if (empty(self::$classes[$modelClassName])) {
+4
View File
@@ -5,6 +5,10 @@ namespace LotGD\Core\Tools\Model;
use LotGD\Core\ModelExtender;
/**
* Trait to add the __call class required for extendable models.
* @package LotGD\Core\Tools\Model
*/
trait ExtendableModel
{
public function __call($method, $arguments)