Exemplo n.º 1
0
 /**
  * Invalidate cached slugs for a given model or entry
  *
  * @param string $modelName Name of the model to invalidate cache for
  * @param string $id If of the only entry to update
  * @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
  * @access public
  */
 public static function invalidateCache($modelName, $id = null)
 {
     return SluggableRoute::invalidateCache($modelName, $id);
 }
Exemplo n.º 2
0
 public function testSlug()
 {
     $SluggableRoute = new SluggableRoute(null, null, null);
     $slug = array('_pk' => 1, '_field' => 'Page Title', '_count' => 1);
     $result = $SluggableRoute->slug($slug);
     $expected = 'page-title';
     $this->assertEquals($expected, $result);
     $slug = array('_pk' => 1, '_field' => 'Routing is fun!', '_count' => 1);
     $result = $SluggableRoute->slug($slug);
     $expected = 'routing-is-fun';
     $this->assertEquals($expected, $result);
     // check for duplicates
     $slug = array('_pk' => 1, '_field' => 'Page Title', '_count' => 3);
     $result = $SluggableRoute->slug($slug);
     $expected = '1-page-title';
     $this->assertEquals($expected, $result);
     // check non-ascii chars
     $slug = array('_pk' => 1, '_field' => 'ñice Pagé!', '_count' => 3);
     $result = $SluggableRoute->slug($slug);
     $expected = '1-nice-page';
     $this->assertEquals($expected, $result);
 }
Exemplo n.º 3
0
 /**
  * Invalidate cached slugs for a given model or entry
  *
  * @param string $modelName Name of the model to invalidate cache for
  * @param string $id If of the only entry to update
  * @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
  * @access public
  */
 public function invalidateCache($modelName, $id = null)
 {
     return $this->_Sluggable->invalidateCache($modelName, $id);
 }