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;
    }
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;
    }
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 ; }
Save a label

@param int $id
@param string $label
@return int
Save a label