示例#1
0
 /**
  *
  * @param RedBean_DomainObject $other
  */
 protected function set1toNAssoc(RedBean_DomainObject $other)
 {
     $this->associationManager->set1toNAssoc($this->bean, $other->bean);
 }
示例#2
0
文件: test.php 项目: blocka/redbean
//$bean = $redbean->load("page","13);show tables; ");
//exit;
testpack("Test ANSI92 issue in clearrelations");
$pdo->Execute("DROP TABLE IF EXISTS book");
$pdo->Execute("DROP TABLE IF EXISTS author");
$pdo->Execute("DROP TABLE IF EXISTS book_author");
$pdo->Execute("DROP TABLE IF EXISTS author_book");
$redbean = $toolbox->getRedBean();
$a = new RedBean_AssociationManager($toolbox);
$book = $redbean->dispense("book");
$author1 = $redbean->dispense("author");
$author2 = $redbean->dispense("author");
$book->title = "My First Post";
$author1->name = "Derek";
$author2->name = "Whoever";
$a->set1toNAssoc($book, $author1);
$a->set1toNAssoc($book, $author2);
pass();
$pdo->Execute("DROP TABLE IF EXISTS book");
$pdo->Execute("DROP TABLE IF EXISTS author");
$pdo->Execute("DROP TABLE IF EXISTS book_author");
$pdo->Execute("DROP TABLE IF EXISTS author_book");
$redbean = $toolbox->getRedBean();
$a = new RedBean_AssociationManager($toolbox);
$book = $redbean->dispense("book");
$author1 = $redbean->dispense("author");
$author2 = $redbean->dispense("author");
$book->title = "My First Post";
$author1->name = "Derek";
$author2->name = "Whoever";
$a->associate($book, $author1);