Skip to content

Commit

Permalink
Merge branch 'main' of github.com:VitexSoftware/php-ease-core
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed Nov 12, 2023
2 parents ace2d6e + 9e88bd3 commit c13f28f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/Ease/Brick.php
Expand Up @@ -6,7 +6,7 @@
* @author Vitex <vitex@hippy.cz>
* @copyright 2009-2023 Vitex@hippy.cz (G)
*
* PHP 7
* PHP 7,8
*/

declare(strict_types=1);
Expand Down Expand Up @@ -108,9 +108,14 @@ public function howToProcess($identifer)
public function setObjectName($objectName = null)
{
if (is_null($objectName)) {
$key = $this->getMyKey($this->data);
$recordId = $this->getMyKey($this->data);
if ($this->nameColumn && $this->getDataValue($this->nameColumn)) {
$key = '(' . $recordId . ')' . $this->getDataValue($this->nameColumn);
} else {
$key = $recordId;
}
if ($key) {
$result = parent::setObjectName(get_class($this) . '@' . $key);
$result = parent::setObjectName($key . '@' . \Ease\Logger\Message::getCallerName($this));
} else {
$result = parent::setObjectName();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Ease/BrickTest.php
Expand Up @@ -62,7 +62,7 @@ public function testSetObjectName()
$this->object->setMyKey(123);
$this->object->setObjectName();
$this->assertEquals(
get_class($this->object) . '@123',
'123@' . get_class($this->object),
$this->object->getObjectName()
);
$this->object->setObjectName('customBrick');
Expand Down

0 comments on commit c13f28f

Please sign in to comment.