File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -274,9 +274,18 @@ public function castIndex($params)
274274
275275    public  function  getIndexValues ($ indexId$ params
276276    {
277-         $ index$ this getIndexes ()[$ indexId
278-         $ format$ this getFormat ();
277+         $ indexnull ;
278+         foreach ($ this getIndexes () as  $ candidate
279+             if ($ candidateiid  == $ indexId
280+                 $ index$ candidate
281+                 break ;
282+             }
283+         }
284+         if (!$ index
285+             throw  new  Exception ("Undefined index:  $ indexId );
286+         }
279287
288+         $ format$ this getFormat ();
280289        $ values
281290        foreach ($ indexparts  as  $ part
282291            $ name$ format$ part0 ]]['name ' ];
Original file line number Diff line number Diff line change 77
88class  MapperTest extends  TestCase
99{
10+     public  function  testIndexRemoved ()
11+     {
12+         $ mapper$ this createMapper ();
13+         $ this clean ($ mapper
14+ 
15+         $ mappergetSchema ()
16+             ->createSpace ('tester ' , [
17+                 'id '  => 'unsigned ' ,
18+                 'name1 '  => 'str ' ,
19+                 'name2 '  => 'str ' ,
20+             ])
21+             ->addIndex ('id ' )
22+             ->addIndex ('name1 ' )
23+             ->addIndex ('name2 ' )
24+             ->removeIndex ('name1 ' );
25+ 
26+         $ mappercreate ('tester ' , [
27+             'id '  => 1 ,
28+             'name1 '  => 'q ' ,
29+             'name2 '  => 'w ' 
30+         ]);
31+ 
32+         $ mapper$ this createMapper ();
33+         $ this assertNotNull ($ mapperfindOne ('tester ' , ['name2 '  => 'w ' ]));
34+     }
35+ 
1036    public  function  testCasting ()
1137    {
1238        $ mapper$ this createMapper ();
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments