Jump to content

ObjectModel : bulk insert


gytske

Recommended Posts

Hello, 

 

I need to initiate some default table rows on module instalation. Tabl is hooked up with ObjectModel.

 

What I would like to know, is there any way to perform a bulk insert (I have a an array of values) ?

 

Currently the code inserts rows one by one :

            foreach($defaultParams as $defParam){
                $newParam = new MyParams();
                $newParam->active = $defParam['active'];
                $newParam->name   = $defParam['name'];
                $newParam->abbr   = $defParam['abbr'];
                $newParam->dim    = $defParam['dim'];
                foreach($this->getLangIDs() as $landId){
                    $newParam->title[$landId] = $defParam['title'];
                }
                if(!$newParam->save()){
                    $this->uninstallFromStep(6);
                    return false;
                }
            }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...