X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fgabordemooij%2Fredbean%2FRedBeanPHP%2FOODBBean.php;h=ac37190617d74793da93b86770636fb1673f2c9f;hp=f77f4f2b0117e35b0ab72e1323aa820b2a60242a;hb=eba34333e3c89f208d2f72fa91351ad019a71583;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/vendor/gabordemooij/redbean/RedBeanPHP/OODBBean.php b/vendor/gabordemooij/redbean/RedBeanPHP/OODBBean.php index f77f4f2b0..ac3719061 100755 --- a/vendor/gabordemooij/redbean/RedBeanPHP/OODBBean.php +++ b/vendor/gabordemooij/redbean/RedBeanPHP/OODBBean.php @@ -548,7 +548,7 @@ class OODBBean implements\IteratorAggregate,\ArrayAccess,\Countable,Jsonable { $myID = $this->properties['id']; - $this->import( $otherBean->export() ); + $this->import( $otherBean->export( FALSE, FALSE, TRUE ) ); $this->id = $myID; @@ -1068,6 +1068,8 @@ class OODBBean implements\IteratorAggregate,\ArrayAccess,\Countable,Jsonable $hasSQL = ($this->withSql !== '' || $this->via !== NULL); $exists = isset( $this->properties[$property] ); $fieldLink = $property . '_id'; + $isFieldLink = (($pos = strrpos($property, '_id')) !== FALSE) && array_key_exists( ($fieldName = substr($property, 0, $pos)), $this->properties ); + if ( ($isOwn || $isShared) && (!$exists || $hasSQL || $differentAlias) ) { @@ -1104,6 +1106,12 @@ class OODBBean implements\IteratorAggregate,\ArrayAccess,\Countable,Jsonable throw new RedException( 'Cannot cast to bean.' ); } } + + if ( $isFieldLink ){ + unset( $this->properties[ $fieldName ]); + $this->properties[ $property ] = NULL; + } + if ( $value === FALSE ) { $value = '0';