Symfony bundle for integrating:
ascetic-soft/rowcast(Connection + DataMapper)ascetic-soft/rowcast-schema(optional schema/migration services + console commands)
- PHP
>=8.4 - Symfony components:
symfony/configsymfony/dependency-injectionsymfony/http-kernel
- Optional:
ascetic-soft/rowcast-schemasymfony/consoleascetic-soft/rowcast-profiler(+symfony/framework-bundlefor the profiler panel)
composer require ascetic-soft/rowcast-bundleMonorepo / contributing: if ascetic-soft/rowcast-profiler is not on Packagist yet, add a path repository in composer.json (see this repo’s RowcastBundle/composer.json) so ^1.0 resolves to the sibling RowcastProfiler directory. Remove the path repository after the profiler is published.
If Symfony Flex does not auto-register the bundle, add it manually to config/bundles.php:
<?php
return [
AsceticSoft\RowcastBundle\RowcastBundle::class => ['all' => true],
];For automatic creation of config/packages/rowcast.yaml and .env variables, use a private Symfony Flex recipe repository.
Prepared recipe files are located in:
../RowcastBundleRecipes/index.json../RowcastBundleRecipes/ascetic-soft.rowcast-bundle.1.0.json
Current endpoint configured in composer.json:
"extra": {
"symfony": {
"bundle": "AsceticSoft\\RowcastBundle\\RowcastBundle",
"endpoint": [
"https://api.github.com/repos/ABorodulin/rowcast-bundle-recipes/contents/index.json",
"flex://defaults"
]
}
}Before using in production, replace ABorodulin/rowcast-bundle-recipes with your real GitHub account/repository and ensure the recipe JSON files are published at that endpoint.
Create config/packages/rowcast.yaml:
rowcast:
connection:
dsn: '%env(DATABASE_DSN)%'
username: '%env(DATABASE_USER)%'
password: '%env(DATABASE_PASSWORD)%'
options: []
nest_transactions: true
schema:
path: '%kernel.project_dir%/database/schema.php'
migrations_path: '%kernel.project_dir%/database/migrations'
migration_table: '_rowcast_migrations'
ignore_tables: []
profiler:
enabled: false
collect_params: true
slow_query_threshold_ms: 50
max_queries: 500Install the profiler package and enable it in config (e.g. only in dev):
composer require ascetic-soft/rowcast-profiler
# For the web debug toolbar / profiler UI:
composer require symfony/web-profiler-bundle --dev# config/packages/dev/rowcast.yaml
rowcast:
profiler:
enabled: trueWhen profiler.enabled is true and the package is present, the bundle decorates AsceticSoft\Rowcast\Connection with ConnectionProfiler, resets the query store between requests (kernel.reset), and registers RowcastDataCollector if symfony/framework-bundle is installed (toolbar + profiler panel Rowcast).
rowcast.schema.path can point either to:
- a schema file (
.php,.yaml,.yml) - a directory with classes that contain Rowcast attributes
Parser selection is automatic:
- if
pathis a directory andAttributeSchemaParseris available, bundle uses attribute parser - otherwise bundle uses file parser based on file extension
Example for attribute-based schema:
rowcast:
schema:
path: '%kernel.project_dir%/src/Entity'
migrations_path: '%kernel.project_dir%/database/migrations'
migration_table: '_rowcast_migrations'
ignore_tables: []Core services (always):
AsceticSoft\Rowcast\Connection- alias
AsceticSoft\Rowcast\ConnectionInterface->AsceticSoft\Rowcast\Connection AsceticSoft\Rowcast\DataMapperrowcast.pdo(factory:Connection::getPdo())
Profiler services (only when profiler.enabled is true and ascetic-soft/rowcast-profiler is installed):
AsceticSoft\RowcastProfiler\InMemoryQueryProfileStore(tagkernel.reset)AsceticSoft\RowcastProfiler\DefaultParameterSanitizerAsceticSoft\RowcastProfiler\SqlClassifierAsceticSoft\RowcastProfiler\RowcastProfilerAsceticSoft\RowcastProfiler\ConnectionProfiler(decoratesAsceticSoft\Rowcast\Connection)AsceticSoft\RowcastBundle\DataCollector\RowcastDataCollector(whensymfony/framework-bundleis available)
Schema services (only when ascetic-soft/rowcast-schema is installed):
AsceticSoft\RowcastSchema\Parser\SchemaParserInterfaceAsceticSoft\RowcastSchema\Diff\SchemaDifferAsceticSoft\RowcastSchema\Migration\MigrationGeneratorAsceticSoft\RowcastSchema\Migration\MigrationLoaderAsceticSoft\RowcastSchema\Introspector\IntrospectorFactoryAsceticSoft\RowcastSchema\Platform\PlatformFactoryAsceticSoft\RowcastSchema\Platform\PlatformInterfaceAsceticSoft\RowcastSchema\Cli\TableIgnoreMatcherAsceticSoft\RowcastSchema\Migration\DatabaseMigrationRepository- alias
AsceticSoft\RowcastSchema\Migration\MigrationRepositoryInterface->DatabaseMigrationRepository AsceticSoft\RowcastSchema\Migration\MigrationRunner
When symfony/console is available:
bin/console rowcast:query "SELECT * FROM users"bin/console rowcast:query "SELECT * FROM users WHERE id = :id" --param id=123
rowcast:query executes arbitrary SQL through the configured Rowcast PDO connection. Queries returning rows are printed as a table; other queries print the affected row count. Repeat --param / -p to pass multiple name=value parameters:
bin/console rowcast:query "SELECT * FROM users WHERE email = :email AND status = :status" \
--param email=user@example.com \
--param status=activeWhen both ascetic-soft/rowcast-schema and symfony/console are available:
bin/console rowcast:diff [--dry-run]bin/console rowcast:makebin/console rowcast:migratebin/console rowcast:rollback [--step=1]bin/console rowcast:status
<?php
use AsceticSoft\Rowcast\DataMapper;
final readonly class UserRepository
{
public function __construct(private DataMapper $mapper)
{
}
// ...
}