RedUNIT\Base\Association::testPoly PHP Method

testPoly() public method

RedBeanPHP does not really feature polymorph relations since they are not really compatible with traditional relational databases. However a light-weight, basic implementation has been added for those circumstances where you can't live without... i.e... possible legacy systems and so on.
public testPoly ( ) : void
return void
    public function testPoly()
    {
        testpack('Testing poly');
        $shoe = R::dispense('shoe');
        $lace = R::dispense('lace');
        $lace->color = 'white';
        $id = R::store($lace);
        $shoe->itemType = 'lace';
        $shoe->item = $lace;
        $id = R::store($shoe);
        $shoe = R::load('shoe', $id);
        $x = $shoe->poly('itemType')->item;
        asrt($x->color, 'white');
    }