mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
ref
This commit is contained in:
@@ -33,6 +33,7 @@ use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Repository\Option\SaveOption;
|
||||
use Espo\Core\Utils\SystemUser;
|
||||
use Espo\ORM\BaseEntity;
|
||||
use Espo\ORM\Defs\Params\AttributeParam;
|
||||
use Espo\ORM\Defs\Params\RelationParam;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\ORM\Relation\RelationsMap;
|
||||
@@ -129,7 +130,7 @@ class Database extends RDBRepository
|
||||
if (
|
||||
$entity->isNew() &&
|
||||
!$entity->has(self::ATTR_ID) &&
|
||||
!$this->getAttributeParam($entity, self::ATTR_ID, 'autoincrement')
|
||||
!$this->getAttributeParam($entity, self::ATTR_ID, AttributeParam::AUTOINCREMENT)
|
||||
) {
|
||||
$entity->set(self::ATTR_ID, $this->recordIdGenerator->generate());
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class Converter
|
||||
'len' => AttributeParam::LEN, // @todo Revise.
|
||||
FieldParam::NOT_NULL => AttributeParam::NOT_NULL,
|
||||
'exportDisabled' => CoreAttributeParam::NOT_EXPORTABLE,
|
||||
'autoincrement' => 'autoincrement',
|
||||
FieldParam::AUTOINCREMENT => AttributeParam::AUTOINCREMENT,
|
||||
'entity' => 'entity',
|
||||
FieldParam::NOT_STORABLE => AttributeParam::NOT_STORABLE,
|
||||
'link' => AttributeParam::RELATION,
|
||||
|
||||
@@ -92,7 +92,7 @@ class AttributeDefs
|
||||
*/
|
||||
public function isAutoincrement(): bool
|
||||
{
|
||||
return $this->data['autoincrement'] ?? false;
|
||||
return $this->data[AttributeParam::AUTOINCREMENT] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,6 +59,11 @@ class AttributeParam
|
||||
*/
|
||||
public const NOT_NULL = 'notNull';
|
||||
|
||||
/**
|
||||
* Autoincrement.
|
||||
*/
|
||||
public const AUTOINCREMENT = 'autoincrement';
|
||||
|
||||
/**
|
||||
* A default value.
|
||||
*/
|
||||
|
||||
@@ -49,6 +49,11 @@ class FieldParam
|
||||
*/
|
||||
public const DB_TYPE = 'dbType';
|
||||
|
||||
/**
|
||||
* Autoincrement.
|
||||
*/
|
||||
public const AUTOINCREMENT = 'autoincrement';
|
||||
|
||||
/**
|
||||
* A max length.
|
||||
*/
|
||||
|
||||
@@ -1308,7 +1308,7 @@ class BaseMapper implements RDBMapper
|
||||
|
||||
$this->queryExecutor->execute($query);
|
||||
|
||||
if ($this->getAttributeParam($entity, Attribute::ID, 'autoincrement')) {
|
||||
if ($this->getAttributeParam($entity, Attribute::ID, AttributeParam::AUTOINCREMENT)) {
|
||||
$this->setLastInsertIdWithinConnection($entity);
|
||||
}
|
||||
}
|
||||
@@ -1564,7 +1564,7 @@ class BaseMapper implements RDBMapper
|
||||
$onlyStorable &&
|
||||
(
|
||||
$this->getAttributeParam($entity, $attribute, AttributeParam::NOT_STORABLE) ||
|
||||
$this->getAttributeParam($entity, $attribute, 'autoincrement') ||
|
||||
$this->getAttributeParam($entity, $attribute, AttributeParam::AUTOINCREMENT) ||
|
||||
(
|
||||
$this->getAttributeParam($entity, $attribute, 'source') &&
|
||||
$this->getAttributeParam($entity, $attribute, 'source') !== 'db'
|
||||
|
||||
Reference in New Issue
Block a user