- Can I use this bundle with Laravel, or is it strictly for Symfony?
- This bundle is designed for Symfony applications using Propel ORM. While Laravel shares some PHP/Symfony ecosystem components, this package is not officially supported for Laravel due to its tight integration with Symfony’s bundle system and Propel’s Symfony-specific configurations. For Laravel, consider Propel’s standalone tools or alternative ORMs like Eloquent.
- How do I migrate an existing Propel XML schema to YAML without breaking my app?
- Start by converting non-critical tables to YAML incrementally. Use Propel’s `diff-schema` command to compare XML and YAML-generated outputs for consistency. For large migrations, write a script (e.g., XSLT) to automate XML-to-YAML conversion, then validate the YAML against your existing schema logic. Test thoroughly in a staging environment before full rollout.
- Does this bundle support Propel 2.x and 3.x, or only specific versions?
- The bundle is primarily tested with Propel 2.x. Check the package’s `composer.json` for exact version constraints, as Propel 3.x introduced breaking changes (e.g., schema syntax). If using Propel 3.x, verify compatibility with the bundle’s YAML parser and Propel’s behavior plugins. For unsupported versions, consider forking the bundle or using Propel’s native XML tools.
- Will using YAML instead of XML improve performance during model generation?
- YAML parsing is generally faster than XML for small to medium schemas, but the performance impact depends on your environment. Benchmark the `propel:build` command with both formats in your CI pipeline. For large schemas, the difference is negligible, but YAML reduces file size and improves readability, which may offset any minor parsing overhead.
- Can I mix YAML and XML schemas in the same project during a migration?
- Yes, the bundle supports hybrid workflows. Place YAML files in `Resources/config/schema.yml` and keep existing XML schemas in their original locations. Propel will merge both sources during model generation, but ensure no naming conflicts between tables defined in YAML and XML. Use feature flags or environment variables to toggle schema sources during testing.
- Are all Propel behaviors (e.g., timestampable, sortable) supported in YAML?
- Most standard behaviors like `timestampable`, `sortable`, and `versionable` are supported, but check the bundle’s documentation for a full list of compatible behaviors. Custom behaviors may require additional configuration or Propel plugin updates. Test behaviors in a sandbox environment to confirm they generate the expected SQL and model code.
- How do I enforce schema consistency across developers? Can I validate YAML files?
- Use PHPStan or custom Symfony Flex recipes to validate YAML syntax and structure. For example, create a PHPStan rule to check for required fields like `primaryKey` or `autoIncrement`. Integrate a CI step to parse YAML files and generate schemas, then compare outputs with a golden master XML file. Tools like `yamllint` can also catch formatting issues.
- What’s the best way to test schema changes in CI/CD without breaking production?
- Store YAML schemas in version control and use CI to validate them with commands like `propel:build` and `propel:diff-schema`. For database-agnostic testing, use SQLite in CI to generate and compare schemas. In production, deploy YAML schemas alongside migrations and use Propel’s `schema:validate` command to catch inconsistencies before runtime.
- Are there alternatives to this bundle for managing Propel schemas in YAML?
- For Propel, this bundle is the most mature YAML-to-XML converter. Alternatives include manually writing XML or using Propel’s native schema tools, but they lack YAML’s readability and schema-as-code benefits. If you’re open to other ORMs, Eloquent (Laravel) or Doctrine (Symfony) support YAML via third-party bundles like `doctrine/doctrine-bundle` with custom DQL or annotations.
- How do I handle database-specific syntax (e.g., PostgreSQL vs. MySQL) in YAML?
- Use Propel’s dialect-specific syntax in YAML, such as `type: VARCHAR(255) COLLATE utf8mb4_unicode_ci` for MySQL or `type: TEXT WITH OIDS` for PostgreSQL. The bundle forwards these to Propel’s schema builder, which handles dialect translation. Test YAML schemas against your target database’s dialect in CI using containerized environments (e.g., Docker) to catch syntax errors early.