- Can I use this package with Laravel’s default Eloquent ORM?
- No, this package is designed exclusively for Propel ORM, which is not natively supported in Laravel. If you’re using Eloquent, you’ll need alternatives like `SoftDeletes` or custom scopes to replicate publish/unpublish functionality.
- What Laravel versions does this package support?
- This package is archived and targets older Laravel setups using Propel 1.x, which likely aligns with PHP 5.4–7.0. Modern Laravel (PHP 8.0+) may require polyfills or forks, but it’s not officially supported.
- How do I install this in a Laravel project using Propel?
- Add the package via Composer (`willdurand/propel-publishable-behavior`), then configure it in `propel.ini` or `build.properties` with the path `vendor.willdurand.propel-publishable-behavior.src.PublishableBehavior`. Follow the README’s Propel-specific setup.
- What’s the difference between `isPublished()` and `filterPublished()`?
- `isPublished()` checks if a single model instance is published, while `filterPublished()` is a query method to retrieve only published records from a dataset. Both respect the `is_published_column` and timeframe settings configured in the behavior.
- Does this package support scheduled publishing (e.g., publish at a future date)?
- Yes, if you enable timeframe support (`with_timeframe=true`), you can set `published_at_column` and `published_until_column` to define start/end dates. Use `filterByPublicationActive()` to query records within active timeframes.
- Is there a way to exclude unpublished records by default in all queries?
- Yes, set the `include_unpublished` parameter to `false` (default) in the behavior’s XML configuration. This ensures unpublished records are excluded unless explicitly included via `includeUnpublished()` in queries.
- What are the risks of using this package in a Laravel project?
- The package is archived, relies on abandoned Propel 1.x, and lacks Laravel-specific support. Risks include security vulnerabilities, compatibility issues with modern PHP/Laravel, and high maintenance burden if Propel breaks or deprecates.
- How can I replicate this functionality in Laravel without Propel?
- Use Eloquent’s `SoftDeletes` trait for soft-unpublishing, custom accessors for `isPublished()`, and query scopes (e.g., `scopePublished()`) to filter records. For timeframes, add `published_at`/`published_until` columns and scope logic.
- Will this package work with Propel 2.x?
- No, this package explicitly targets Propel 1.x and may not work with Propel 2.x due to breaking changes. Propel 2.x is also not widely adopted in Laravel ecosystems, making this a non-starter for most projects.
- How do I handle unpublished records in API responses if I use this package?
- Use the `includeUnpublished()` query method to fetch unpublished records when needed. For API responses, manually filter results or use the `hasPublicationStarted()`/`hasPublicationEnded()` methods to check publication status before serialization.