This repository has been archived by the owner. It is now read-only.

fixed storing failed with invalid field in JTableAsset when $updateNulls... #1077

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

elinw commented Jun 21, 2012

I actually came across this today but unsetting alias just means that I got an error with the next field. The real problem is that for some reason the category fields are attempting to save in the assets table. Are you instantiating JTableNested directly?

Contributor

vietvh commented Jun 22, 2012

Hi Elin,

What did you mean "error with the next field"

Viet

Contributor

elinw commented Jun 22, 2012

After you unset alias it will want you to unset path and then note and extension. The error message just tells you the first one that fails.

Contributor

vietvh commented Jul 27, 2012

I got a quick fix by manually unset alias field in my class which extends JTable

Contributor

elinw commented Oct 10, 2012

Do you have more fields in your table?

Contributor

vietvh commented Oct 11, 2012

Yes, my table has around 20 fields

Contributor

elinw commented Oct 18, 2012

If you change it to not updatenulls it works okay?

Contributor

vietvh commented Oct 18, 2012

Yes my issue is directly related to $updateNulls

Contributor

elinw commented Oct 18, 2012

So I have tried to reproduce the issue following your instructions in the CMS tracker on a clean database and I could not reproduce. That doesn't mean there is not a bug, just that that method couldn't reproduce it.

I think one question that must be answered is where this save to the alias field is coming from. Alias is not a required field in JTableNested (a property yes, a field no). Usually the field comes from something like JTableContent or JTableCategory and that is where it would be saved. JTable manages saving the asset for you if $this->_trackAssets is true, it is not something that you should do directly.

I have in fact gotten this error one time, as I mentioned in the CMS tracker. I can't remember exactly why I did it, but i had instantiated JTableNested and that was why I said the other day that I think JTableNested should be abstract.

Contributor

elinw commented Oct 22, 2012

So upon some investigation in some of the cases where this has appeared it seems to be a case of a corrupted asset table. Can you please check your asset table in the case where you are seeing this error? Specifically you might look to see if there is mroe than one record with parent_id of 0. Also as mentioned the other reason this happens is if someone instantiates JTableNested directly which is why it should possibly be made abstract.

Contributor

elinw commented Nov 2, 2012

I think I found the place generating the fatal error the problem is definitely corrupt assets or trying to access the asset table directly in the getRootId() method of JTableNested if the table that is being evaluated does not have an alias field. Property_exists is not an adequate screen here, we need to know if the column exists before attempting the query. We also might want to allow another column name to be used e.g. name as in the case of JTableAsset.

Contributor

elinw commented Nov 5, 2012

See #1665 @vietvh if you apply that change does it solve your issue?

Contributor

vietvh commented Nov 11, 2012

@elinw Its good for me, closing my pull request

@vietvh vietvh closed this Nov 11, 2012

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.