Skip to content

Commit 2ee405f

Browse files
author
Daria Prusova
committed
[orm] rename formula to delayed field
1 parent 89b19f1 commit 2ee405f

6 files changed

Lines changed: 21 additions & 21 deletions

File tree

orm/collection/BaseCollection.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use umi\orm\manager\TObjectManagerAware;
2424
use umi\orm\metadata\field\IField;
2525
use umi\orm\metadata\field\relation\ManyToManyRelationField;
26-
use umi\orm\metadata\field\special\FormulaField;
26+
use umi\orm\metadata\field\special\DelayedField;
2727
use umi\orm\metadata\IMetadata;
2828
use umi\orm\metadata\IObjectType;
2929
use umi\orm\object\IObject;
@@ -415,15 +415,15 @@ public function persistNewObject(IObject $object)
415415
/**
416416
* {@inheritdoc}
417417
*/
418-
public function persistRecalculatedObject(IObject $object, array $formulaProperties)
418+
public function persistRecalculatedObject(IObject $object, array $delayedProperties)
419419
{
420420
if (!$this->contains($object)) {
421421
throw new NotAllowedOperationException($this->translate(
422422
'Cannot persist modified object. Object from another collection given.'
423423
));
424424
}
425-
if (count($formulaProperties)) {
426-
$this->executeUpdate($object, $formulaProperties);
425+
if (count($delayedProperties)) {
426+
$this->executeUpdate($object, $delayedProperties);
427427
}
428428
}
429429

@@ -439,18 +439,18 @@ public function persistModifiedObject(IObject $object)
439439
}
440440

441441
$modifiedProperties = [];
442-
$formulaProperties = [];
442+
$delayedProperties = [];
443443

444444
foreach ($object->getModifiedProperties()as $property) {
445-
if ($property->getField() instanceof FormulaField) {
446-
$formulaProperties[] = $property;
445+
if ($property->getField() instanceof DelayedField) {
446+
$delayedProperties[] = $property;
447447
} else {
448448
$modifiedProperties[] = $property;
449449
}
450450
}
451451

452-
if ($formulaProperties) {
453-
$this->getObjectPersister()->storeRecalculatedObject($object, $formulaProperties);
452+
if ($delayedProperties) {
453+
$this->getObjectPersister()->storeRecalculatedObject($object, $delayedProperties);
454454
}
455455

456456
if (count($modifiedProperties)) {

orm/collection/ICollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ public function persistModifiedObject(IObject $object);
193193
* которые должны быть вычислены после сохранения всех объектов.
194194
* @internal
195195
* @param IObject $object
196-
* @param IProperty[] $formulaProperties
196+
* @param IProperty[] $delayedProperties
197197
* @return
198198
*/
199-
public function persistRecalculatedObject(IObject $object, array $formulaProperties);
199+
public function persistRecalculatedObject(IObject $object, array $delayedProperties);
200200

201201
/**
202202
* Запускает запросы на удаление объекта коллекции.

orm/collection/LinkedHierarchicCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@ public function persistModifiedObject(IObject $object)
8686
/**
8787
* {@inheritdoc}
8888
*/
89-
public function persistRecalculatedObject(IObject $object, array $formulaProperties)
89+
public function persistRecalculatedObject(IObject $object, array $delayedProperties)
9090
{
9191
if (!$this->contains($object)) {
9292
throw new NotAllowedOperationException($this->translate(
9393
'Cannot persist recalculated object. Object from another collection given.'
9494
));
9595
}
9696
$this->getCommonHierarchy()
97-
->persistRecalculatedObject($object, $formulaProperties);
98-
parent::persistRecalculatedObject($object, $formulaProperties);
97+
->persistRecalculatedObject($object, $delayedProperties);
98+
parent::persistRecalculatedObject($object, $delayedProperties);
9999
}
100100

101101
/**

orm/metadata/field/IField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ interface IField
5757
const TYPE_ORDER = 'order';
5858

5959
const TYPE_COUNTER = 'counter';
60-
const TYPE_FORMULA = 'formula';
60+
const TYPE_DELAYED = 'delayed';
6161

6262
const TYPE_PASSWORD = 'password';
6363
const TYPE_MONEY = 'money';

orm/metadata/field/special/FormulaField.php renamed to orm/metadata/field/special/DelayedField.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
use umi\orm\object\IObject;
2222

2323
/**
24-
* Класс поля, значение которого вычисляется по формуле
24+
* Класс поля, значение которого вычисляется заданным методом после сохранения всех объектов.
2525
*/
26-
class FormulaField extends BaseField implements IScalarField, ICalculableField
26+
class DelayedField extends BaseField implements IScalarField, ICalculableField
2727
{
2828
use TScalarField;
2929
use TCalculableField;
@@ -99,20 +99,20 @@ protected function applyConfiguration(array $config)
9999
{
100100
if (!isset($config['dataType']) || !is_string($config['dataType'])) {
101101
throw new UnexpectedValueException($this->translate(
102-
'Formula field configuration should contain data type and it should be a string.'
102+
'Delayed field configuration should contain data type and it should be a string.'
103103
));
104104
}
105105

106106
if (!in_array($config['dataType'], $this->allowedDataTypes)) {
107107
throw new OutOfBoundsException($this->translate(
108-
'Data type "{type}" is not supported for formula field.',
108+
'Data type "{type}" is not supported for delayed field.',
109109
['type' => $config['dataType']]
110110
));
111111
}
112112

113113
if (!isset($config['formula']) || !is_string($config['formula'])) {
114114
throw new UnexpectedValueException($this->translate(
115-
'Formula field configuration should contain formula and it should be a string.'
115+
'Delayed field configuration should contain option "formula" and it should be a string.'
116116
));
117117
}
118118

orm/toolbox/factory/MetadataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class MetadataFactory implements IMetadataFactory, IFactory
7777
IField::TYPE_LEVEL => 'umi\orm\metadata\field\special\LevelField',
7878
IField::TYPE_ORDER => 'umi\orm\metadata\field\special\OrderField',
7979
IField::TYPE_COUNTER => 'umi\orm\metadata\field\special\CounterField',
80-
IField::TYPE_FORMULA => 'umi\orm\metadata\field\special\FormulaField',
80+
IField::TYPE_DELAYED => 'umi\orm\metadata\field\special\DelayedField',
8181
IField::TYPE_MONEY => 'umi\orm\metadata\field\special\MoneyField',
8282
IField::TYPE_PASSWORD => 'umi\orm\metadata\field\special\PasswordField',
8383
IField::TYPE_FILE => 'umi\orm\metadata\field\special\FileField',

0 commit comments

Comments
 (0)