本文整理汇总了PHP中RedBean_OODBBean::copyMetaFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP RedBean_OODBBean::copyMetaFrom方法的具体用法?PHP RedBean_OODBBean::copyMetaFrom怎么用?PHP RedBean_OODBBean::copyMetaFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBean_OODBBean
的用法示例。
在下文中一共展示了RedBean_OODBBean::copyMetaFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMetaData
/**
* Test meta data methods.
*
* @return void
*/
public function testMetaData()
{
testpack('Test meta data');
$bean = new RedBean_OODBBean();
$bean->setMeta("this.is.a.custom.metaproperty", "yes");
asrt($bean->getMeta("this.is.a.custom.metaproperty"), "yes");
asrt($bean->getMeta("nonexistant"), NULL);
asrt($bean->getMeta("nonexistant", "abc"), "abc");
asrt($bean->getMeta("nonexistant.nested"), NULL);
asrt($bean->getMeta("nonexistant,nested", "abc"), "abc");
$bean->setMeta("test.two", "second");
asrt($bean->getMeta("test.two"), "second");
$bean->setMeta("another.little.property", "yes");
asrt($bean->getMeta("another.little.property"), "yes");
asrt($bean->getMeta("test.two"), "second");
// Copy Metadata
$bean = new RedBean_OODBBean();
$bean->setMeta("meta.meta", "123");
$bean2 = new RedBean_OODBBean();
asrt($bean2->getMeta("meta.meta"), NULL);
$bean2->copyMetaFrom($bean);
asrt($bean2->getMeta("meta.meta"), "123");
}
示例2:
asrt(is_array($bean->getMeta("arr")), true);
asrt($bean->getMeta("nonexistant"), NULL);
asrt($bean->getMeta("nonexistant", "abc"), "abc");
asrt($bean->getMeta("nonexistant.nested"), NULL);
asrt($bean->getMeta("nonexistant,nested", "abc"), "abc");
$bean->setMeta("test.two", "second");
asrt($bean->getMeta("test.two"), "second");
$bean->setMeta("another.little.property", "yes");
asrt($bean->getMeta("another.little.property"), "yes");
asrt($bean->getMeta("test.two"), "second");
testpack("UNIT TEST RedBean OODBBean: copyMeta");
$bean = new RedBean_OODBBean();
$bean->setMeta("meta.meta", "123");
$bean2 = new RedBean_OODBBean();
asrt($bean2->getMeta("meta.meta"), NULL);
$bean2->copyMetaFrom($bean);
asrt($bean2->getMeta("meta.meta"), "123");
testpack("UNIT TEST RedBean OODBBean: import");
$bean = new RedBean_OODBBean();
$bean->import(array("a" => 1, "b" => 2));
asrt($bean->a, 1);
asrt($bean->b, 2);
testpack("UNIT TEST RedBean OODBBean: export");
$bean->setMeta("justametaproperty", "hellothere");
$arr = $bean->export();
asrt(is_array($arr), true);
asrt(isset($arr["a"]), true);
asrt(isset($arr["b"]), true);
asrt($arr["a"], 1);
asrt($arr["b"], 2);
asrt(isset($arr["__info"]), false);