Componette

Componette

orisai

orisai / nextras-object-mapper

[WIP] orisai/object-mapper extension for nextras/orm

download-cloud-line composer require orisai/nextras-object-mapper

Orisai
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, /* ... */))

No release at this moment. Try to create first one.

bar-chart-fill

Statistics

download-cloud-fill
12
star-fill
2
bug-fill
0
flashlight-fill
346d
price-tag-2-line

Badges

guide-fill

Dependencies

php (>=7.4.0 <8.3.0)
nextras/orm (^4.0.0)
Componette Componette felix@nette.org