RedBeanPHP\Facade::renameAssociation PHP Method

renameAssociation() public static method

Facade method for AQueryWriter::renameAssociation()
public static renameAssociation ( string | array $from, string $to = NULL ) : void
$from string | array
$to string
return void
    public static function renameAssociation($from, $to = NULL)
    {
        AQueryWriter::renameAssociation($from, $to);
    }

Usage Example

Example #1
0
 /**
  * Test prettier tables using via().
  */
 public function testViaPrettification()
 {
     R::nuke();
     R::renameAssociation('tbl_author_tbl_friend', 'tbl_author_friend');
     $author = R::xdispense(AUTHOR);
     $author->name = 'Mr. Quill';
     $friend = R::xdispense(FRIEND);
     $friend->name = 'Muse';
     $author->{FRIENDLIST}[] = $friend;
     $id = R::store($author);
     //print_r(R::inspect()); exit;
     $author = R::load(AUTHOR, $id);
     $tables = array_flip(R::inspect());
     asrt(isset($tables['tbl_author_friend']), TRUE);
     asrt(isset($tables['tbl_author_tbl_friend']), FALSE);
     asrt(count($author->{FRIENDLIST}), 1);
     AQueryWriter::clearRenames();
 }
All Usage Examples Of RedBeanPHP\Facade::renameAssociation