orisai / nextras-object-mapper
orisai/object-mapper extension for nextras/orm
v1.x-dev
2024-06-21 22:24 UTC
Requires
- php: 7.4 - 8.3
- nextras/orm: ^4.0.0
- orisai/exceptions: ^1.0.0
- orisai/object-mapper: ^0.1.0|^0.2.0
Requires (Dev)
- brianium/paratest: ^6.3.0
- doctrine/annotations: ^1.12.0|^2.0.0
- infection/infection: ^0.26.0|^0.27.0|^0.28.0|^0.29.0
- orisai/coding-standard: ^3.0.0
- phpstan/extension-installer: ^1.0.0
- phpstan/phpstan: ^1.0.0
- phpstan/phpstan-deprecation-rules: ^1.0.0
- phpstan/phpstan-phpunit: ^1.0.0
- phpstan/phpstan-strict-rules: ^1.0.0
- phpunit/phpunit: ^9.5.0
- staabm/annotate-pull-request-from-checkstyle: ^1.7.0
This package is auto-updated.
Last update: 2024-12-21 23:23:58 UTC
README
Nextras Object Mapper
orisai/object-mapper extension for nextras/orm
📄 Check out our documentation.
💸 If you like Orisai, please make a donation. Thank you!
use App\User\DB\User; use OriNextras\ObjectMapper\Rules\EntityFromId; use Orisai\ObjectMapper\Attributes\Expect\IntValue; use Orisai\ObjectMapper\Attributes\Modifiers\FieldName; use Orisai\ObjectMapper\MappedObject; final class EntityFetchingInput implements MappedObject { /** * @FieldName("userId") * @EntityFromId( * name="userId" * entity=User::class * idRule=@IntValue(unsigned=true, castNumericString=true) * ) */ public User $user; }
$data = [ 'userId' => 666, ]; $input = $processor->process($data, EntityFetchingInput::class); // $input == EntityFetchingInput(user: User(id: 666, /* ... */))