Skip to content

Commit

Permalink
Set initial properties objectName and keyColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
Vítězslav Dvořák committed Jan 30, 2024
1 parent 27d4196 commit 4aef07e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
7 changes: 5 additions & 2 deletions debian/changelog
@@ -1,4 +1,4 @@
php-vitexsoftware-ease-core (1.42.0) UNRELEASED; urgency=medium
php-vitexsoftware-ease-core (1.43.0) UNRELEASED; urgency=medium

[ Vítězslav Dvořák ]
* all unit tests pass
Expand Down Expand Up @@ -78,7 +78,10 @@ php-vitexsoftware-ease-core (1.42.0) UNRELEASED; urgency=medium
* phpstan
* Init Improvements

-- vitex <info@vitexsoftware.cz> Tue, 23 Jan 2024 23:37:04 +0100
[ ]
* Set initial properties objectName and keyColumn

-- <vitezslav.dvorak@spojenet.cz> Tue, 30 Jan 2024 13:05:10 +0100

php-vitexsoftware-ease-core (0.12) UNRELEASED; urgency=medium

Expand Down
22 changes: 16 additions & 6 deletions src/Ease/Brick.php
Expand Up @@ -4,9 +4,9 @@
* Main Ease Class
*
* @author Vitex <vitex@hippy.cz>
* @copyright 2009-2023 Vitex@hippy.cz (G)
* @copyright 2009-2024 Vitex@hippy.cz (G)
*
* PHP 7,8
* PHP 8
*/

declare(strict_types=1);
Expand Down Expand Up @@ -105,9 +105,9 @@ public function howToProcess($identifer)
*
* @return string new name
*/
public function setObjectName($objectName = null)
public function setObjectName($objectName = '')
{
if (is_null($objectName)) {
if (empty($objectName)) {
$recordId = $this->getMyKey($this->data);
if ($this->nameColumn && $this->getDataValue($this->nameColumn)) {
$key = '(' . $recordId . ')' . $this->getDataValue($this->nameColumn);
Expand All @@ -128,18 +128,28 @@ public function setObjectName($objectName = null)

/**
* Object init value stub
*
* @param mixed $init
*/
public function setInit($init)
{
}

/**
* Set/override object properties stub
* Set/override object properties objectName and keyColumn
*
* @param array $properties
*/
public function setProperties($properties)
public function setProperties(array $properties = [])
{
if (array_key_exists('objectName', $properties)) {
$this->setObjectName($properties['objectName']);
}
if (array_key_exists('keyColumn', $properties)) {
$this->setKeyColumn($properties['keyColumn']);
}
if (array_key_exists('nameColumn', $properties)) {
$this->nameColumn = $properties['nameColumn'];
}
}
}

0 comments on commit 4aef07e

Please sign in to comment.