Compare commits
8 Commits
0.1.4
...
8dc0a27fd9
Author | SHA1 | Date | |
---|---|---|---|
8dc0a27fd9 | |||
5b1a61cd3b | |||
ae172b902c | |||
d3cb68c5ca | |||
7f81b987c9 | |||
0a46604e0c | |||
af801e769f | |||
e9bee7fa48 |
@ -61,10 +61,10 @@ abstract class Model extends BaseModel implements ModelInterface {
|
|||||||
], [
|
], [
|
||||||
Model::PARENT_KEY => 'id'
|
Model::PARENT_KEY => 'id'
|
||||||
]);
|
]);
|
||||||
$parent_table = (new $parent_class())->getTable();
|
$parent_table = (new $parent_model_class())->getTable();
|
||||||
return $this->factory
|
return $this->factory
|
||||||
->find($parent_model_class)
|
->find($parent_model_class)
|
||||||
->wherer([
|
->where([
|
||||||
[
|
[
|
||||||
$relation_definitions[Model::PARENT_KEY],
|
$relation_definitions[Model::PARENT_KEY],
|
||||||
$this->{$relation_definitions[Model::SELF_KEY]}
|
$this->{$relation_definitions[Model::SELF_KEY]}
|
||||||
@ -82,7 +82,7 @@ abstract class Model extends BaseModel implements ModelInterface {
|
|||||||
Model::SELF_KEY => 'id',
|
Model::SELF_KEY => 'id',
|
||||||
Model::SIBLING_KEY => 'id'
|
Model::SIBLING_KEY => 'id'
|
||||||
]);
|
]);
|
||||||
$sibling_table = (new $sibling_class())->getTable();
|
$sibling_table = (new $sibling_model_class())->getTable();
|
||||||
return $this->find($sibling_model_class)
|
return $this->find($sibling_model_class)
|
||||||
->select([
|
->select([
|
||||||
[
|
[
|
||||||
|
@ -27,6 +27,7 @@ class Model {
|
|||||||
if (!class_exists($model_class)) {
|
if (!class_exists($model_class)) {
|
||||||
throw new \InvalidArgumentException('El modelo ' . $model_class . ' no existe.');
|
throw new \InvalidArgumentException('El modelo ' . $model_class . ' no existe.');
|
||||||
}
|
}
|
||||||
|
$this->reset();
|
||||||
$this->class = $model_class;
|
$this->class = $model_class;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -79,10 +80,10 @@ class Model {
|
|||||||
}
|
}
|
||||||
foreach ($conditions as $c) {
|
foreach ($conditions as $c) {
|
||||||
$cond = (object) [
|
$cond = (object) [
|
||||||
'column' => $j['column'] ?? $j[0],
|
'column' => $c['column'] ?? $c[0],
|
||||||
'value' => $j['value'] ?? $j[1],
|
'value' => $c['value'] ?? $c[1],
|
||||||
'sym' => strtolower($j['sym'] ?? ($j[2] ?? '=')),
|
'sym' => strtolower($c['sym'] ?? ($c[2] ?? '=')),
|
||||||
'type' => strtolower($j['type']) ?? ''
|
'type' => strtolower($c['type']) ?? ''
|
||||||
];
|
];
|
||||||
$this->conditions []= $cond;
|
$this->conditions []= $cond;
|
||||||
}
|
}
|
||||||
|
6
common/Form/Model.php
Normal file
6
common/Form/Model.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProVM\Common\Form;
|
||||||
|
|
||||||
|
use ProVM\Common\Define\Model as BaseModel;
|
||||||
|
|
||||||
|
abstract class Model extends BaseModel {}
|
Reference in New Issue
Block a user