plenta / contao-jobs-basic-bundle

Contao Job Manager
https://plenta.io/contao-erweiterungen/jobs-basic
GNU Lesser General Public License v3.0
20 stars 6 forks source link

Adding database columns in DCA not possible #64

Closed dennisbohn closed 1 year ago

dennisbohn commented 1 year ago

I would like to add an icon picker to the job offer by using the rocksolid-icon-picker-bundle, so I extended the dca.

$GLOBALS['TL_DCA']['tl_plenta_jobs_basic_offer']['fields']['icon'] = [
    'inputType'               => 'rocksolid_icon_picker',
    'eval'                    => ['iconFont' => 'files/fonts/icons.svg'],
    'sql'                     => "varchar(4) NULL"
];

The field is visible in the backend but the database column wasnt created in the Contao Manager. The only way I found at the moment was to edit the file src/Plenta/ContaoJobsBasic/Entity/TlPlentaJobsBasicOffer.php.

    /**
     * @ORM\Column(type="string", length=4, nullable=true)
     */
    protected string $icon;

Is there an update-friendly way to add database columns to the table "tl_plenta_jobs_basic_offer"?

christianbarkowsky commented 1 year ago

Hey @dennisbohn thx for you message. We're looking at a possible solution.

fritzmg commented 1 year ago

imho entities should not be used in extensions for tables that are supposed to be extendable (i.e. for tables that use a DataContainer for a back end view).

dennisbohn commented 1 year ago

Hey @dennisbohn thx for you message. We're looking at a possible solution.

Thank you. :) I can create the database column manually and saving in backend also works. Of course, when I open the Contao Manager, it tries to delete the column again when I do not add the column in the TlPlentaJobsBasicOffer class. If there is some way to prevent this, it wolud already help a lot.

christianbarkowsky commented 1 year ago

Da waren wir wohl mit den Entities und Repositories zu voreilig. @fritzmg Schade ... wird jetzt umgebaut. 😈 @dennisbohn

christianbarkowsky commented 1 year ago

Fixed! @dennisbohn