Yii Framework Forum: Store Data Temporarily Before Saving Into Database - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Store Data Temporarily Before Saving Into Database Rate Topic: -----

#1 User is offline   candyman 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 22-December 13

Posted 24 August 2014 - 11:09 AM

I am developing an application using Yii framework where I need to store data temporarily before saving into database.The screen is divided into master and detail. The detail part is shown using CGridview. I want to store the data in CGridview tempoarily and when the save button is clicked it will be stored into database. The temporary data should be editable and can be deleted. I thought of storing it in session, but then how can I generate new primary key ID for the rows? Also emptying the table and then inserting all the values in CGridview into table is not possible, because I am linking those IDs to a history table of the same data.How can I do this? Please help.

#2 User is offline   adadavasa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 15-August 12
  • Location:Colombo

Posted 24 August 2014 - 10:01 PM

Hi candyman

One of following solutions may help to solve your problem.

01. Maintaining a temporary table to store temporary data.
You will be able to create a separate table to maintain the temporary data, Once the editing done, simply move the data into live table.

02. Use a combination of session && transaction
(Set the session manually , Set the model object into the session, reuse the session + object , Commit once the process done,)

03. Maintaining a status in the database.
Maintain 2 status in the database - (1 => Live 2 => On Processing)

Sri Nuwan Perera

#3 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 298
  • Joined: 26-September 09

Posted 25 August 2014 - 05:46 AM

I am having the same problem. But I have no working solution yet.

One thing that I was thinking of is using CGridView + CArrayDataProvider for the details. Once, save button is pressed, then the CArrayDataProvider will be stored in database. But I am not yet trying it :)



Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users