Skip to content

Commit

Permalink
space class for uppercased strings
Browse files Browse the repository at this point in the history
  • Loading branch information
nekufa committed Oct 15, 2024
1 parent c519345 commit 273feae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function getChanges(): array

public function getClassSpace(int|string $class): int|string
{
if (!is_integer($class) && class_exists($class)) {
if (!is_integer($class) && !ctype_lower($class) && class_exists($class)) {
if (!array_key_exists($class, $this->classNames)) {
$this->registerClass($class);
}
Expand Down
12 changes: 12 additions & 0 deletions tests/MapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ public function testClassBased()
$this->assertEquals($row, $mapper->findOne('constructor'));
}

public function testAttribute()
{
$mapper = $this->createMapper();
$attribute = $mapper->createSpace('attribute');
$attribute->addProperty('key', 'string');
$attribute->addProperty('value', 'string');
$attribute->addIndex(['key']);

$attribute = $mapper->findOrCreate('attribute', ['key' => 'tester']);
$this->assertNotNull($attribute);
}

public function testIdleField()
{
$mapper = $this->createMapper();
Expand Down

0 comments on commit 273feae

Please sign in to comment.