WIP mc search nodes

This commit is contained in:
fbsanchez 2020-09-16 15:54:43 +02:00
parent 81cdfdbaa1
commit 9d40f900ba
1 changed files with 20 additions and 0 deletions

View File

@ -51,6 +51,26 @@ abstract class Entity
protected $table = '';
/**
* Instances a new object using array definition.
*
* @param string $class_str Class name.
* @param array $data Fields data.
*
* @return object With current definition.
*/
public static function build(string $class_str, array $data=[])
{
$obj = new $class_str();
// Set values.
foreach ($data as $k => $v) {
$obj->{$k}($v);
}
return $obj;
}
/**
* Defines a generic constructor to extract information of the object.
*