OK, I really am struggling. I cannot for the life of me get any data
to insert into the tblpeople table in the db.
I am able to run the following query directly on the db:
<cfquery name="setPerson" datasource="#dsn#">
INSERT INTO tblpeople (PersonID,Title)
VALUES(4972,'Mrs')
</cfquery>
When it is done through reactor via:
persRecord = createRecord('tblpeople')
persRecord.setPersonID(4972)
persRecord.setTitle('Mrs')
persRecord.save()
The values are placed into the persRecord object and can be dumped out
but the actual save() does nothing.
Can anyone point me in the right direction. My reactor config is below
(from previous email). I want to say it is a problem with one of the
relationships and I think I will set up a really cut down version of
my reactor config file to see if that is true, but otherwise I am at a
loss. I have never had Reactor do this before - It must be something I
have done wrong but I cannot see what??
More help would be really appreciated, the client wants it ready for
Monday and I don't have time to start restructuring too much.
Cheers,
Dave
On 25 Apr 2008, at 14:06, David Phipps wrote:
I have just been digging through the abstractRecord.cfc to try and
see if there were any clues in there and I noticed the beforeSave
and afterSave methods looking at relationships. Could these be
causing the problems and be preventing the save()?
Here is the relevant parts of reactor config:
<object name="tblbuilding">
<hasMany name="tblpeople">
<link name="tjoinpeoplechurches" />
</hasMany>
</object>
<object name="tblposition">
<hasOne name="tlkppositiontype">
<relate from="PositionTypeID" to="PositionTypeID" />
</hasOne>
<hasMany name="tblpeople">
<link name="tjoinpeopleposition" />
</hasMany>
</object>
<object name="tblpeople">
<hasOne name="tlkppeopletype">
<relate from="PeopleTypeID" to="PeopleTypeID" />
</hasOne>
<hasMany name="tblbuilding">
<link name="tjoinpeoplechurches" />
</hasMany>
<hasMany name="tblposition">
<link name="tjoinpeopleposition" />
</hasMany>
</object>
<object name="tjoinpeopleposition">
<hasOne name="tblpeople">
<relate from="PersonID" to="PersonID" />
</hasOne>
<hasOne name="tblposition">
<relate from="PositionID" to="PositionID" />
</hasOne>
</object>
<object name="tlkppeopletype" />
I am not setting PeopleTypeID in the tblpeople table and any new
records will not have any corresponding rows in tblbuilding.
Could this be a reason for not saving?
Cheers,
Dave
On 25 Apr 2008, at 13:29, David Phipps wrote:
It should only be creating a record for each form field that has
been added to the list. Should be about 10-20 I would think.
The problem I am having at the moment is that whilst the
setPosition method is inserting/updating a row in the db the
setPerson method is not. I added some cflog tags to watch what was
happening and as far as I can tell a record is created or loaded
with a PersonID and then the save() method is called before. At the
moment I am only sending one form field through so it should only
be called once (which it is) but the data is not getting save into
the db. If I run an Insert using MySQL query browser using just the
data that I am submitting to it (PersonID, Title) the it works.
Initially I had some NOT NULLS which had no default values but I
have changed these and deleted the Reactor generated files. Still
not saving.
Is there a way to destroy a record object once I have done the save
in readiness for the next loop? I am effectively doing the
following (Pseudo code):
loop (in controller calls saveField())
(saveField calls setPerson() which:
creates or Loads record
setField
save
endloop
The loop then runs for each form field submitted. I have tried with
just 1 field or multiples and it still doesn't save. Is there any
way to look at any exceptions it might be throwing?
Cheers,
Dave
On 25 Apr 2008, at 12:40, Dominic Watson wrote:
The downside is the setPosition method is called each and every
time the setPerson method is called and really it only needs to be
called the first time for a given Person.
As long as it doesn't create unneccessary records and isn't
grinding the system to a slowdown then I'd say go with it to meet
your deadline. Sounds like there is another phase to the project
which might just render the code obsolete or give you the chance
to rethink it if neccessary.
It doesn't sound bad though at all.
Dominic
On 25/04/2008, David Phipps <[EMAIL PROTECTED]>
wrote:
Hi,
Thanks to Dominic and Chris, I am a little further forward. The
next phase of the project will be a little more like View Person >
see list of positions w/dates but at the moment we have a form
which shows information for many users in many positions (It is a
Church form). The data is then saved to a duplicate set of tables.
In the admin side the Validators view the updated duplicate
records and compare them to the existing data (2 forms side by
side in accordions for each position - some forms have 750 input
fields!!). If any info has changed they can approve the change
which copies the data for the approved field from the duplicate
table to the live table in the db.
The main problem I had originally was the way this approved data
had to be added. I couldn't just submit all dup data as some
fields may not have been approved so using jquery I added a little
icon next to each field. The validator then clicks on each icon
next to the field they wish to approve. Once they have finished
they click a button and this sends a list of approved fieldid's
and their corresponding values to my save fuseaction. I then loop
over the fieldid list and save each field individually.
I use 3 methods in my serviceCFC: saveField (receives ID,fieldid
and fieldvalue). This then calls a setPerson method which is a
general method able to accept all possible values for a Person (It
creates or loads a Person) and sets each field. The saveField also
calls setPosition which saves the Person into this Position along
with Start and/or Finish Dates.
The upside is I have the flexibility to approve a single field or
all the fields for a person or multiple people if needed. The
downside is the setPosition method is called each and every time
the setPerson method is called and really it only needs to be
called the first time for a given Person.
I could pass a loop count to the saveField method which would work
but I am not comfortable passing a loop count number from my
controller into my cfc?
Can anyone see a big floor in the above architecture?
Unfortunately I am up against the wall on the deadline - so it is
more about getting to work than how it works!
Any suggestions would be great.
Cheers,
Dave
On 23 Apr 2008, at 15:38, Dominic Watson wrote:
How are you getting to the page on which you need to display the
data on a single record here? I assume it will be something like:
View person ->
-> -> See list of positions w/ dates - click on one...
-> -> -> See position info
If that's the kind of situation - you should be able to use the
new PK you have created (and not have to extend the object).
To 'overide' an inherited method, simply create a new method with
the same name in the extended component. If you need to call the
original base method you can use the super scope:
<cffunction name="save" hint="Overriding save method">
...
...
<cfset something = super.save(...)>
</cffunction>
HTH
Dominic
On 23/04/2008, David Phipps <[EMAIL PROTECTED]>
wrote:
Many thanks Chris and Dominic. I just discovered the table
already has a Unique index based upon the PersonID,PositionID and
StartDate but how do I get Reactor to use that info or do I use a
gateway query to grab the record matching the 3 fields and then
use the resulting id (I just added a pk to the table) to create a
Record object?
It is looking a lot more promising and not having to restructure
the db is going to save me a bundle of time.
I was reading the docs before I sent the first mail and whilst I
understand that I can add new methods to a record object I can't
seem to see the next step which I guess is to extend the save()
method to include any extras I add to the record object? Does
that even make sense?! Although I think if I am on the right
lines with my first paragraph above I won't need to extend the
record object as I will be able retrieve an individual record.
Cheers,
Dave
P.S. OT: Has anyone managed to get Verity running on a standalone
server (we have it running in VMWare on an OS X server) and then
return search results? We are able to connect,create collections
and index them but all searches result in 0 records found. The
index is a query based index. ColdFusion 8 on OS X has a helluva
hole in it - no search engine. Using some code from Ray Camden
and various others I have managed to get a basic Lucene search
running but sheesh what a nightmare!
On 23 Apr 2008, at 14:58, Dominic Watson wrote:
Aha, the live docs:
http://livedocs.reactorframework.com/Reactor_Documentation.htm
Dominic
Just realised that link wasn't very useful, damned ajax!
Once in the docs do:
Reactor Crash Course -> Customizing reactor objects
--
Blog it up: http://fusion.dominicwatson.co.uk
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- --
_______________________________________________________________________
David Phipps
Director, Chapel Studios
T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765
240899
New Broad Street House, 35 New Broad Street, London, EC2M 1NH, UK
http://www.chapel-studios.co.uk
_______________________________________________________________________
The Chapel Studios group of companies are registered in England.
'Chapel Studios' and the Chapel Studios logo are registered
trademarks of Chapel Studios. The information in this email is
confidential, intended solely for the addressee, and may be
legally privileged. If you are not the addressee or authorized
to receive this for the addressee, you must not use, copy,
disclose or take any action based upon this message or any
information herein. If you have received this message in error,
please advise the sender immediately by reply e-mail.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
--
Blog it up: http://fusion.dominicwatson.co.uk
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
_______________________________________________________________________
David Phipps
Director, Chapel Studios
T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765 240899
New Broad Street House, 35 New Broad Street, London, EC2M 1NH, UK
http://www.chapel-studios.co.uk
_______________________________________________________________________
The Chapel Studios group of companies are registered in England.
'Chapel Studios' and the Chapel Studios logo are registered
trademarks of Chapel Studios. The information in this email is
confidential, intended solely for the addressee, and may be
legally privileged. If you are not the addressee or authorized to
receive this for the addressee, you must not use, copy, disclose
or take any action based upon this message or any information
herein. If you have received this message in error, please advise
the sender immediately by reply e-mail.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
--
Blog it up: http://fusion.dominicwatson.co.uk
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
_______________________________________________________________________
David Phipps
Director, Chapel Studios
T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765 240899
New Broad Street House, 35 New Broad Street, London, EC2M 1NH, UK
http://www.chapel-studios.co.uk
_______________________________________________________________________
The Chapel Studios group of companies are registered in England.
'Chapel Studios' and the Chapel Studios logo are registered
trademarks of Chapel Studios. The information in this email is
confidential, intended solely for the addressee, and may be legally
privileged. If you are not the addressee or authorized to receive
this for the addressee, you must not use, copy, disclose or take
any action based upon this message or any information herein. If
you have received this message in error, please advise the sender
immediately by reply e-mail.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- --
_______________________________________________________________________
David Phipps
Director, Chapel Studios
T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765 240899
New Broad Street House, 35 New Broad Street, London, EC2M 1NH, UK
http://www.chapel-studios.co.uk
_______________________________________________________________________
The Chapel Studios group of companies are registered in England.
'Chapel Studios' and the Chapel Studios logo are registered
trademarks of Chapel Studios. The information in this email is
confidential, intended solely for the addressee, and may be legally
privileged. If you are not the addressee or authorized to receive
this for the addressee, you must not use, copy, disclose or take any
action based upon this message or any information herein. If you
have received this message in error, please advise the sender
immediately by reply e-mail.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- --
_______________________________________________________________________
David Phipps
Director, Chapel Studios
T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765 240899
New Broad Street House, 35 New Broad Street, London, EC2M 1NH, UK
http://www.chapel-studios.co.uk
_______________________________________________________________________
The Chapel Studios group of companies are registered in England.
'Chapel Studios' and the Chapel Studios logo are registered trademarks
of Chapel Studios. The information in this email is confidential,
intended solely for the addressee, and may be legally privileged. If
you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose or take any action based
upon this message or any information herein. If you have received
this message in error, please advise the sender immediately by reply e-
mail.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --