Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8587181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:30:29+00:00 2026-06-11T22:30:29+00:00

I am saving records in a transaction using symfony1.4 and Doctrine. The rows inserted

  • 0

I am saving records in a transaction using symfony1.4 and Doctrine.

The rows inserted are coming from a CSV file which is updated regularly. I have already got a method that checks if the records in the CSV match that in the DB and do not insert.

What I’m ideally wanting to do though, is to set a user flash telling them how many rows have been updated whenever they import the CSV file.

            $conn = ProductTable::getInstance()->getConnection();
            $conn->beginTransaction();

            try {
                $row = 1;
                while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                    if ($row > 1) {
                        $values = array(
                            'blah'            => null
                        );

                        $obj= ProductTable::getInstance()->findOrCreateNewProduct(
                            $values['blah']
                        );


                        $obj->merge($values);
                        $obj->save($conn);
                    }

                    $row++;
                }

                $conn->commit();

            } catch (Doctrine_Exception $e) {
                $conn->rollback();

                throw $e;
            }

I’m wondering how I’d get these updated fields. Is it in the actions.class.php or is it in the actual form.class.php file?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:30:30+00:00Added an answer on June 11, 2026 at 10:30 pm

    On the you can call a Doctrine_Record::getModified() which will give you an array of fields modified (with their values though that doesnt matter for you). Then you can call count on the returned array and keep a cumulative total outside your loop.

            $conn = ProductTable::getInstance()->getConnection();
            $conn->beginTransaction();
            $nbModified = 0;
    
            try {
                $row = 1;
                while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                    if ($row > 1) {
                        $values = array(
                            'blah'            => null
                        );
    
                        $obj= ProductTable::getInstance()->findOrCreateNewProduct(
                            $values['blah']
                        );
    
    
                        $obj->merge($values);
                        $nbModified += count($obj->getModified());
                        $obj->save($conn);
                    }
    
                    $row++;
                }
    
                $conn->commit();
    
                // return $nbModified or otherwise do something with it here
    
            } catch (Doctrine_Exception $e) {
                $conn->rollback();
                // youre rolling back so just for consistency set $nbModified to zero
                $nbModified = 0;
    
                throw $e;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am importing a csv file with more then 5,000 records in it. What
I have a problem with saving a huge amount of records to database using
I'm saving entities/records with the EF, but i'm curious if there is another way
After saving a String value into memcached using the Danga client, I attempted to
I'm saving a struct into a .dat file. Lets suppose I have to edit
I have a number of Gearman workers running constantly, saving things like records of
I'm having a few issues with duplicate records in my database which I believe
I got a system which queries LDAP, pulls 50,000 records (say) and formats that
Using VB6 I am saving the user the entry in the database. Code. rst.Open
I have a script which works great for saving users in comma seperated value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.