insitaction / managers-bundle
A simple toolbox.
Installs: 807
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.0
- ext-fileinfo: *
- doctrine/doctrine-bundle: ^2.4
- doctrine/orm: ^2.10
- league/csv: ^9.8
- shuchkin/simplexlsx: ^1.0
- symfony/deprecation-contracts: ^2.1
- symfony/framework-bundle: ^5.3
- symfony/serializer: ^5.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.4
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.3
- phpstan/phpstan-doctrine: ^1.0
- phpstan/phpstan-strict-rules: ^1.1
- phpstan/phpstan-symfony: ^1.0
- symfony/config: ^5.3
- symfony/dependency-injection: ^5.3
- symfony/http-kernel: ^5.3
- symfony/yaml: ^5.3
This package is auto-updated.
Last update: 2023-09-18 11:23:37 UTC
README
Manager bundle
Manager bundle is a symfony bundle.
Installation:
composer require insitaction/managers-bundle
Usage:
RequestManager
<?php namespace Insitaction\ManagersBundle\Manager\Request\Adapter; use App\Entity\TestCase; class TestCaseRequestAdapter extends AbstractRequestAdapter implements RequestAdapterInterface { /** * @return class-string */ public function entityClassname(): string { return TestCase::class; } public function setGroups(): array { return ['test']; } public function multiple(): bool { return true; // Or false } /** * @param array<mixed, mixed> $data */ public function validation(array $data): bool { //TODO add validation return true; } }
ImportManager
<?php namespace App\Import; use App\DBAL\EnumUserRoleType; use App\Entity\User; use Insitaction\ManagersBundle\Manager\Import\ImportInterface; use Insitaction\ManagersBundle\Manager\Import\ImportableEntityInterface; use Insitaction\ManagersBundle\Manager\Import\AbstractImport; class UserRolesImport extends AbstractImport implements ImportInterface { public function getClass(): string { return User::class; } public function getColumnIdentifier(): int { return 3; // the id of the column in the imported file } public function getPropertyIdentifier(): string { return 'email'; // the entity field name } public function getOffset(): int { return 0; } /** @param array<int, string> $row */ public function loadEntityFromArray(array $row, ImportableEntityInterface $user): void { // your own logic } }