Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6936b5cc8f | |||
| f50782c930 | |||
| 731af328d7 | |||
| 5756573d8d | |||
| eb75e69d60 |
@@ -4,7 +4,10 @@ namespace PHPSTORM_META {
|
||||
|
||||
// Reflect
|
||||
use Kiri\Di\Container;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
override(ContainerInterface::get(0), map('@'));
|
||||
override(Container::make(0), map('@'));
|
||||
override(Container::get(0), map('@'));
|
||||
override(Container::create(0), map('@'));
|
||||
// override(\Hyperf\Utils\Context::get(0), map('@'));
|
||||
|
||||
+6
-6
@@ -221,7 +221,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$an = Kiri::app()->getAnnotation();
|
||||
$an = Kiri::app()->getNote();
|
||||
$an->injectProperty($this);
|
||||
}
|
||||
|
||||
@@ -682,8 +682,8 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
*/
|
||||
public function getAttribute(string $name)
|
||||
{
|
||||
if ($this->hasAnnotation($name)) {
|
||||
return $this->runAnnotation($name, $this->_attributes[$name]);
|
||||
if ($this->hasNote($name)) {
|
||||
return $this->runNote($name, $this->_attributes[$name]);
|
||||
}
|
||||
return $this->_attributes[$name] ?? null;
|
||||
}
|
||||
@@ -695,7 +695,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
* @param string $type
|
||||
* @return mixed
|
||||
*/
|
||||
protected function runAnnotation(string $name, mixed $value, string $type = self::GET): mixed
|
||||
protected function runNote(string $name, mixed $value, string $type = self::GET): mixed
|
||||
{
|
||||
return call_user_func($this->_annotations[$type][$name], $value);
|
||||
}
|
||||
@@ -922,7 +922,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
* @param string $type
|
||||
* @return array
|
||||
*/
|
||||
protected function getAnnotation(string $type = self::GET): array
|
||||
protected function getNote(string $type = self::GET): array
|
||||
{
|
||||
return $this->_annotations[$type] ?? [];
|
||||
}
|
||||
@@ -933,7 +933,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
* @param string $type
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasAnnotation($name, string $type = self::GET): bool
|
||||
protected function hasNote($name, string $type = self::GET): bool
|
||||
{
|
||||
if (!isset($this->_annotations[$type])) {
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||
namespace Database;
|
||||
|
||||
|
||||
use Annotation\Inject;
|
||||
use Note\Inject;
|
||||
use Database\Affair\BeginTransaction;
|
||||
use Database\Affair\Commit;
|
||||
use Database\Affair\Rollback;
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
namespace Database;
|
||||
|
||||
|
||||
use Annotation\Inject;
|
||||
use Note\Inject;
|
||||
use Exception;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Abstracts\Providers;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Database\Annotation;
|
||||
namespace Database\Note;
|
||||
|
||||
|
||||
use Attribute;
|
||||
@@ -11,9 +11,9 @@ use Exception;
|
||||
|
||||
/**
|
||||
* Class Get
|
||||
* @package Annotation\Model
|
||||
* @package Note\Model
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)] class Get extends \Annotation\Attribute
|
||||
#[Attribute(Attribute::TARGET_METHOD)] class Get extends \Note\Attribute
|
||||
{
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Database\Annotation;
|
||||
namespace Database\Note;
|
||||
|
||||
|
||||
use Annotation\Attribute;
|
||||
use Note\Attribute;
|
||||
use Database\Base\Relate;
|
||||
use Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Class Relation
|
||||
* @package Annotation\Model
|
||||
* @package Note\Model
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD)] class Relation extends Attribute
|
||||
{
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Database\Annotation;
|
||||
namespace Database\Note;
|
||||
|
||||
|
||||
use Annotation\Attribute;
|
||||
use Note\Attribute;
|
||||
use Database\Base\Setter;
|
||||
use Exception;
|
||||
|
||||
@@ -194,7 +194,7 @@ trait Builder
|
||||
$class = $defaultConfig['class'];
|
||||
unset($defaultConfig['class']);
|
||||
|
||||
$builder = Kiri::getDi()->get($class, [], $defaultConfig);
|
||||
$builder = Kiri::getDi()->make($class, [], $defaultConfig);
|
||||
$builder->setValue($condition[2]);
|
||||
$builder->setColumn($condition[1]);
|
||||
} else {
|
||||
|
||||
@@ -522,7 +522,7 @@ trait QueryTrait
|
||||
$conditionArray = $this->sprintf($conditionArray, $value, $opera);
|
||||
}
|
||||
|
||||
$this->where = ['(' . implode(' AND ', $this->where) . ') OR (' . $conditionArray . ')'];
|
||||
$this->where = ['((' . implode(' AND ', $this->where) . ') OR (' . $conditionArray . '))'];
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user