Skip to content
This repository has been archived by the owner on Nov 26, 2017. 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

vietvh
Copy link
Contributor

@vietvh vietvh commented Mar 30, 2012

@elinw
Copy link
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?

@vietvh
Copy link
Contributor Author

vietvh commented Jun 22, 2012

Hi Elin,

What did you mean "error with the next field"

Viet

@elinw
Copy link
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.

@vietvh
Copy link
Contributor Author

vietvh commented Jul 27, 2012

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

@elinw
Copy link
Contributor

elinw commented Oct 10, 2012

Do you have more fields in your table?

@vietvh
Copy link
Contributor Author

vietvh commented Oct 11, 2012

Yes, my table has around 20 fields

@elinw
Copy link
Contributor

elinw commented Oct 18, 2012

If you change it to not updatenulls it works okay?

@vietvh
Copy link
Contributor Author

vietvh commented Oct 18, 2012

Yes my issue is directly related to $updateNulls

@elinw
Copy link
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.

@elinw
Copy link
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.

@elinw
Copy link
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.

@elinw
Copy link
Contributor

elinw commented Nov 5, 2012

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

@vietvh
Copy link
Contributor Author

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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants