Fix className not returning the classname in the right format.
This commit is contained in:
parent
c600688725
commit
6aef212350
@ -250,8 +250,7 @@ class Model {
|
||||
|
||||
foreach ($elem as $key => $value) {
|
||||
$index = array_search($key, $propertyNames);
|
||||
if (is_numeric($index) && isset($value) &&
|
||||
enum_exists($properties[$index]->getType()->getName()))
|
||||
if (is_numeric($index) && enum_exists($properties[$index]->getType()->getName()))
|
||||
$instance->$key = $properties[$index]->getType()->getName()::tryfrom($value);
|
||||
else
|
||||
$instance->$key = $value;
|
||||
@ -305,13 +304,8 @@ class Model {
|
||||
*/
|
||||
public static function className(): string
|
||||
{
|
||||
return strtolower(
|
||||
preg_replace(
|
||||
'/(?<!^)[A-Z]/', '_$0',
|
||||
substr(
|
||||
return substr(
|
||||
strrchr(get_called_class(), '\\'), 1
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -326,7 +320,13 @@ class Model {
|
||||
{
|
||||
if (isset(static::$table))
|
||||
return static::$table;
|
||||
return static::className().static::$tableSufix;
|
||||
|
||||
return strtolower(
|
||||
preg_replace(
|
||||
'/(?<!^)[A-Z]/', '_$0',
|
||||
static::className()
|
||||
)
|
||||
).static::$tableSufix;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -861,7 +861,7 @@ class Model {
|
||||
* @param bool $resetQuery
|
||||
* (opcional) Indica si el query debe reiniciarse o no (por defecto es true).
|
||||
*
|
||||
* @return array<static>
|
||||
* @return array
|
||||
* Arreglo con instancias del la clase actual resultantes del query.
|
||||
*/
|
||||
public static function get(bool $resetQuery = true): array
|
||||
@ -897,7 +897,7 @@ class Model {
|
||||
/**
|
||||
* Obtener todos los elementos del la tabla de la instancia actual.
|
||||
*
|
||||
* @return array<static>
|
||||
* @return array
|
||||
* Contiene un arreglo de instancias de la clase actual.
|
||||
*/
|
||||
public static function all(): array
|
||||
|
Loading…
Reference in New Issue
Block a user