orm intefrace changes and cleanup

This commit is contained in:
Yuri Kuznetsov
2019-12-11 15:27:57 +02:00
parent 604aca50c8
commit 30dec3be52
4 changed files with 11 additions and 23 deletions
+3 -3
View File
@@ -81,7 +81,7 @@ abstract class Entity implements IEntity
}
}
public function clear($name = null)
public function clear(?string $name = null)
{
if (is_null($name)) {
$this->reset();
@@ -126,7 +126,7 @@ abstract class Entity implements IEntity
}
}
public function get($name, $params = [])
public function get(string $name, $params = [])
{
if ($name == 'id') {
return $this->id;
@@ -148,7 +148,7 @@ abstract class Entity implements IEntity
return null;
}
public function has($name)
public function has(string $name)
{
if ($name == 'id') {
return !!$this->id;
-1
View File
@@ -33,4 +33,3 @@ interface ICollection
{
}
+8 -18
View File
@@ -56,37 +56,27 @@ interface IEntity
const HAS_CHILDREN = 'hasChildren';
/**
* Push values from the array.
* E.g. insert values into the bean from a request data.
* @param array $arr Array of field - value pairs
*/
function populateFromArray(array $arr);
/**
* Resets all fields in the current model.
* Resets all attributes in the current model.
*/
function reset();
/**
* Set field.
* Set attribute.
*/
function set($name, $value);
/**
* Get field.
* Get attribute.
*/
function get($name);
function get(string $name);
/**
* Check field is set.
* Check attribute is set.
*/
function has($name);
function has(string $name);
/**
* Clear field.
* Clear attribute.
*/
function clear($name);
function clear(?string $name);
}
@@ -65,4 +65,3 @@ class RepositoryFactory
$this->defaultRepositoryClassName = $defaultRepositoryClassName;
}
}