Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.65 KB

File metadata and controls

53 lines (37 loc) · 1.65 KB

Upgrade to 6.0

There are new fields for the database. Please run migrations. (see README.md)

php bin/console make:migration
php bin/console doctrine:migrations:migrate

Migrating to a Custom Entity

Version 6 introduces extensible entity architecture. If you want to extend the ScheduledCommand entity with custom fields:

Important: Custom entities MUST extend BaseScheduledCommand. Implementing only ScheduledCommandInterface is not supported, as validation constraints and ORM mappings are defined on the base class.

  1. Create your custom entity extending BaseScheduledCommand:
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Dukecity\CommandSchedulerBundle\Entity\BaseScheduledCommand;

#[ORM\Entity]
#[ORM\Table(name: 'scheduled_command')]
class MyScheduledCommand extends BaseScheduledCommand
{
    #[ORM\Column(type: 'string', nullable: true)]
    private ?string $customField = null;

    // getters/setters...
}
  1. Configure the bundle to use your entity:
# config/packages/dukecity_command_scheduler.yaml
dukecity_command_scheduler:
    scheduled_command_class: App\Entity\MyScheduledCommand
  1. Create a migration for any custom columns:
php bin/console make:migration
php bin/console doctrine:migrations:migrate

Note: When you configure a custom entity class, the bundle automatically excludes its default ScheduledCommand entity from Doctrine mappings to prevent table name conflicts.

Important: The base table structure (scheduled_command) is unchanged, so your existing data will continue to work with your custom entity class. Only custom fields you add require a migration.