This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

creg33270
creg33270

I use the builder plugin and a partial in it. If I enter data in the partial without saving the actual record first, I get an sql error (SQLState [23000]: Integrity violation constraint: 1048 column 'item_id' cannot be null...).

How can I let the partial check if the corresponding record is already there? (or how can I prevent the partial from being called if the current record has not yet been created, i.e. saved?).

Supplementary information: The attached pictures illustrate the basic problem.

First I integrate the partial control into my model. Used element from the control list of the Builder Plugin enter image description here

Then I create the required relationships etc. on the code level. Finally I can access the partial in my new plugin.

Access to the embedded partial.

And this is where the problem arises. I must first create the record under General (i.e. enter data there and click on Save.). Otherwise I get the above error message.

I'm looking for an option, which checks whether the click on Create Translations first checks whether the corresponding record already exists.

Last updated

creg33270
creg33270

The problem is solved.

The reason for the Integrity violation constraint was that the foreign key to the item ID (item table) must be nullable in the translation table.

However, this results in the problem that an item can be created with a translation but without the corresponding item data.

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.