feat: initial commit of camelia/orm

Attribute-mapped Active Record ORM for MariaDB/MySQL over PDO.

- Attribute-driven metadata: TableName, PrimaryKey, AutoIncrement, Column,
  Guarded, Ignore, Required, Enum, Nullable, Length, Precision, Unique,
  UniqueGroup, Index, MaxLength.
- Relationship mapping: BelongsTo, HasOne, HasMany, BelongsToMany with
  batched eager loading and a 3-level depth limit.
- Orm entry point with fromArray, fromPdo, fromEnv and nested transactions.
- Immutable Query with Cond operators and GroupCond grouping.
- Repository read and write API, pagination, and typed exception hierarchy.
- Declares PHP >=8.3; Mago and PHPStan pin the parser to 8.3.
- MIT license.
This commit is contained in:
dgarcia committed 2026-11-15 10:14:22 -03:00
commit 66e93e3070
97 files changed
+12188

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Camelia\Orm\Tests\Unit\Support;
use Camelia\Orm\Support\NameConverter;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
final class NameConverterTest extends TestCase
{
#[Test]
public function it_converts_internal_capitals_to_underscores(): void
{
self::assertSame('codigo_empresa', NameConverter::camelToSnake('codigoEmpresa'));
self::assertSame('id_zona', NameConverter::camelToSnake('idZona'));
self::assertSame('normal', NameConverter::camelToSnake('normal'));
self::assertSame('', NameConverter::camelToSnake(''));
}
#[Test]
public function it_never_prefixes_the_first_character(): void
{
self::assertSame('nombre', NameConverter::camelToSnake('Nombre'));
}
#[Test]
public function it_round_trips_simple_names(): void
{
self::assertSame('codigoEmpresa', NameConverter::snakeToCamel('codigo_empresa'));
}
}