Image+ fields not saving in MIGXdb

I have added two image fields (image2 and image3) to my MIGXdb config, but for some reason they don’t save. I’ve had one field (image) in there before which is saving fine. All image fields have the exact same settings (except the fieldname) like inputTVtype imageplus and I set some configs for the needed aspect ratio. The whole Image+ part seems to work fine though, as I can select and crop the images as I need, but the values just won’t save for the two newly created ones.

I have added them in the schema of course and I checked that their respective columns are also added to the table in the database. What am I doing wrong here?

Schema
<?xml version="1.0" encoding="UTF-8"?>
<model package="berichte" baseClass="xPDOObject" platform="mysql" defaultEngine="InnoDB" version="1.1">
	<object class="Berichte" table="berichte" extends="xPDOSimpleObject">
		<field key="title" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
		<field key="text" dbtype="varchar" precision="5000" phptype="string" null="false" />
		<field key="image" dbtype="varchar" precision="1000" phptype="string" null="false" default="" />
		<field key="image2" dbtype="varchar" precision="1000" phptype="string" null="false" default="" />
		<field key="image3" dbtype="varchar" precision="1000" phptype="string" null="false" default="" />
		<field key="createdon" dbtype="datetime" phptype="datetime" null="true" />
		<field key="createdby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
		<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
		<field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
		<field key="level0" dbtype="varchar" precision="255" phptype="string" null="false" />
		<field key="level1" dbtype="varchar" precision="255" phptype="string" null="false" />
		<field key="level2" dbtype="varchar" precision="255" phptype="string" null="false" />
		<field key="team_id" dbtype="varchar" precision="255" phptype="string" null="false" />
		<field key="datum" dbtype="date" phptype="date" null="true" />
	</object>
</model>

use dbtype “text”
varchar can’t have a length of 1000 or 5000

I adjusted the dbtype, but it still only saves the first (original) image field.

A general question: Do I have to set the precision attribute for all types? I read that every type has its own limits by default so I was wondering, what this attribute is used for…

Not sure that is correct. At least on newer versions the maximum size should be 65,535.

If you set the type of image2 and image3 temporarily to text in the configuration, can you save some data then?

This way you can maybe evaluate if there is a problem with your schema or if it has something to do with Image+.

Still no success in saving to those fields as text as well.

I did a quick test with your original schema and it seems to work on my system.

You could delete all the files in core/components/berichte/model and maybe even the database-table (if there is no data in it) and create/parse the schema again.

you could try to debug, what happens in the update - processor

Will try to delete the model directory, would like to avoid deleting the whole table if not necessary but can do if everything else fails.

In regards to that I found an error in the log:

PHP warning: Cannot modify header information - headers already sent by (output started at .../core/components/migx/processors/mgr/default/update.php:1)

So after deleting the files I can’t even save the schema again. After entering the package name, pasting in the schema and hitting save, I tried clearing the field and loading it again and it stays empty. Also no new directories are created under core/components/berichte/model.

So I deleted the whole package and database table and started from scratch. All seems to work until I try to create an entry now. After hitting the “Done” Button in the CMP to save a new entry nothing happens. The MIGX window stays open and nothing is saved anywhere.

A view in the error log shows:
Could not load class: Bericht from mysql.bericht.

Apparently the class name in my schema was different from the one in the configuration (Bericht vs Berichte). I have absolutely no idea though, how that changed as I haven’t touched either of those parts since creating the table. Also I don’t think that error showed up in the logs before I tried deleting the local files. Well…

…atleast after fixing that, it seems to work now. Thank you for all the help!

Sorry for the bad advice. It seems that the “Save schema”-button expects that there is already a schema-file present to override. Another click on the “Create Package”-button would have solved the problem (as it creates a default schema-file).

Nothing to be sorry about, I should have figured this out before even creating this thread, but like I said, pretty sure signs of that when I first looked at it…

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.