Fatal error when saving record with changed primary key

A place for users and developers of the Xataface to discuss and receive support.

Fatal error when saving record with changed primary key

Postby andperry » Wed Oct 03, 2012 12:47 am

Please see topic 5556. I am posting this in response to Steve's request to raise the issue as a new topic.

I have experienced a problem for a long time in which a fatal error occurs when attempting to save an edited record having changed the primary key. I have been able to live with the problem as I have written some code to detect the change of primary key and on saving the record, to redirect the browser to the list view of the table. The fatal error can easily be viewed by clicking the browser 'back' button immediately after saving the record. I have just tried it again today using Xataface 1.3.2 and the error message is as follows:-

Code: Select all
Fatal error: Call to a member function hasJoinTable() on a non-object in /media/Data/Users/Common/Documents/WebSite/All Sites/public_html/xataface-1.3.2/Dataface/FormTool.php on line 930


This was done on the following platform:-

Ubuntu Server 12.04
Apache 2.2.22
PHP 5.3.10
MySQL 5.5.22
Xataface 1.3.2

Please let me know if you need any further information.

Thanks,

Andrew.
andperry
 
Posts: 57
Joined: Wed Feb 18, 2009 9:20 am
Location: Wirral, UK

Re: Fatal error when saving record with changed primary key

Postby pkennedy » Wed Oct 03, 2012 9:05 am

Andrew,

I'm experiencing the exact same issue. I too have only seen it when editing (a part of) the primary key. Any chance you could share your workaround? Thanks!
pkennedy
 
Posts: 10
Joined: Tue Oct 02, 2012 3:05 am

Re: Fatal error when saving record with changed primary key

Postby shannah » Wed Oct 03, 2012 9:57 am

I have posted this bug in the issue tracker.
http://bugs.weblite.ca/view.php?id=1161

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Fatal error when saving record with changed primary key

Postby andperry » Thu Oct 04, 2012 12:09 am

If anyone wants my workaround please let me know (Patrick - I've already sent it to you). I've decided not to publish it on the forum as it does not really contribute to the ongoing development of Xataface, but I'm happy to send it on request by private message if it is going to be helpful. It's quite messy and I'm looking forward to getting rid of it when a proper bug fix appears!

Thanks,

Andrew.
andperry
 
Posts: 57
Joined: Wed Feb 18, 2009 9:20 am
Location: Wirral, UK

Re: Fatal error when saving record with changed primary key

Postby pkennedy » Thu Oct 04, 2012 1:42 am

Steve and Andrew,

Thank you both for your prompt responses. Let me know if there is any additional information I can provide that might help resolve the issue.

Out of curiosity, does the issue tracker require a separate log in?

Patrick
pkennedy
 
Posts: 10
Joined: Tue Oct 02, 2012 3:05 am

Re: Fatal error when saving record with changed primary key

Postby dvelayos » Mon Jan 28, 2013 5:30 am

The problem seems to be that the URL redirect after the update maintains de Old ID instead of the new Id. If you change it manually to the new value, it shows the record edition without problems, so i suposse that redirecting on the afterUpdate event should work.
dvelayos
 
Posts: 2
Joined: Thu Nov 11, 2010 8:17 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved