original_string: protected function saveLabel( $id, $label )
      {
          $locale = $this->getLocale();
          $sql    = $this->sql( $this->getTableInSchema(
              static::$labelTableName
          ) );
  
          $update = $sql->update()
                        ->set( array(
                            'label'   => $label,
                        ) )
                        ->where( array(
                            'menuId'  => $id,
                            'locale'  => $locale,
                        ) );
  
          $affected = $sql->prepareStatementForSqlObject( $update )
                          ->execute()
                          ->getAffectedRows();
  
          if ( $affected < 1 )
          {
              $insert = $sql->insert()
                            ->values( array(
                                'menuId'  => $id,
                                'locale'  => $locale,
                                'label'   => $label,
                            ) );
  
              $affected = $sql->prepareStatementForSqlObject( $insert )
                              ->execute()
                              ->getAffectedRows();
          }
  
          return $affected;
      }
code: protected function saveLabel( $id, $label )
      {
          $locale = $this->getLocale();
          $sql    = $this->sql( $this->getTableInSchema(
              static::$labelTableName
          ) );
  
          $update = $sql->update()
                        ->set( array(
                            'label'   => $label,
                        ) )
                        ->where( array(
                            'menuId'  => $id,
                            'locale'  => $locale,
                        ) );
  
          $affected = $sql->prepareStatementForSqlObject( $update )
                          ->execute()
                          ->getAffectedRows();
  
          if ( $affected < 1 )
          {
              $insert = $sql->insert()
                            ->values( array(
                                'menuId'  => $id,
                                'locale'  => $locale,
                                'label'   => $label,
                            ) );
  
              $affected = $sql->prepareStatementForSqlObject( $insert )
                              ->execute()
                              ->getAffectedRows();
          }
  
          return $affected;
      }
code_tokens: protected function saveLabel ( $ id , $ label ) { $ locale = $ this -> getLocale ( ) ; $ sql = $ this -> sql ( $ this -> getTableInSchema ( static :: $ labelTableName ) ) ; $ update = $ sql -> update ( ) -> set ( array ( 'label' => $ label , ) ) -> where ( array ( 'menuId' => $ id , 'locale' => $ locale , ) ) ; $ affected = $ sql -> prepareStatementForSqlObject ( $ update ) -> execute ( ) -> getAffectedRows ( ) ; if ( $ affected < 1 ) { $ insert = $ sql -> insert ( ) -> values ( array ( 'menuId' => $ id , 'locale' => $ locale , 'label' => $ label , ) ) ; $ affected = $ sql -> prepareStatementForSqlObject ( $ insert ) -> execute ( ) -> getAffectedRows ( ) ; } return $ affected ; }
docstring: Save a label
  
  @param int $id
  @param string $label
  @return int
docstring_tokens: Save a label