0

Zend 1.8 Geeks!

I always use model_mapper to update insert and fetch data from the db by this example :

    $a=somthin;
    $y=qwe;
    $dataMapper = new model_mapper_data();
    $dataModel  = new model_data();

    $dataEntity=$dataModel->AA=$a ; 
 =>   $dataMapper->update($dataEntity,'x'=$y);

Now on the last line the Mapper generates a query to update all table row columns AA and rest stored in the data-model where 'x'=$y.

isn't there a way to force the Mapper to update specific columns only?

Suhayb
  • 3,163
  • 3
  • 23
  • 30

1 Answers1

0

Well all what you need is to not give the update method the model entity Since the model initialize objects for all of the columns .

Just give it an array of the columns names you would like to modify and Pair them to their values like below :

Mapper->update('column_name'=>value);
Suhayb
  • 3,163
  • 3
  • 23
  • 30