RedbeanPHP update
This commit is contained in:
parent
3f85193eab
commit
04b11e8670
1 changed files with 13 additions and 21 deletions
|
@ -3323,7 +3323,8 @@ abstract class RedBean_QueryWriter_AQueryWriter { //bracket must be here - other
|
|||
$insertvalues[] = $pair['value'];
|
||||
}
|
||||
|
||||
return $this->insertRecord( $table, $insertcolumns, array( $insertvalues ) );
|
||||
//Otherwise psql returns string while MySQL/SQLite return numeric causing problems with additions (array_diff)
|
||||
return (string) $this->insertRecord( $table, $insertcolumns, array( $insertvalues ) );
|
||||
}
|
||||
|
||||
if ( $id && !count( $updatevalues ) ) {
|
||||
|
@ -5689,17 +5690,11 @@ class RedBean_OODB extends RedBean_Observable
|
|||
*/
|
||||
private function processTrashcan( $bean, $ownTrashcan )
|
||||
{
|
||||
$myFieldLink = $bean->getMeta( 'type' ) . '_id';
|
||||
if ( is_array( $ownTrashcan ) && count( $ownTrashcan ) > 0 ) {
|
||||
$first = reset( $ownTrashcan );
|
||||
if ( $first instanceof RedBean_OODBBean ) {
|
||||
$alias = $bean->getMeta( 'sys.alias.' . $first->getMeta( 'type' ) );
|
||||
if ( $alias ) {
|
||||
$myFieldLink = $alias . '_id';
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ( $ownTrashcan as $trash ) {
|
||||
$myFieldLink = $bean->getMeta( 'type' ) . '_id';
|
||||
$alias = $bean->getMeta( 'sys.alias.' . $trash->getMeta( 'type' ) );
|
||||
if ( $alias ) $myFieldLink = $alias . '_id';
|
||||
|
||||
if ( isset( $this->dep[$trash->getMeta( 'type' )] ) && in_array( $bean->getMeta( 'type' ), $this->dep[$trash->getMeta( 'type' )] ) ) {
|
||||
$this->trash( $trash );
|
||||
} else {
|
||||
|
@ -5776,18 +5771,15 @@ class RedBean_OODB extends RedBean_Observable
|
|||
*/
|
||||
private function processAdditions( $bean, $ownAdditions )
|
||||
{
|
||||
$myFieldLink = $bean->getMeta( 'type' ) . '_id';
|
||||
if ( $bean && count( $ownAdditions ) > 0 ) {
|
||||
$first = reset( $ownAdditions );
|
||||
if ( $first instanceof RedBean_OODBBean ) {
|
||||
$alias = $bean->getMeta( 'sys.alias.' . $first->getMeta( 'type' ) );
|
||||
if ( $alias ) {
|
||||
$myFieldLink = $alias . '_id';
|
||||
}
|
||||
}
|
||||
}
|
||||
$beanType = $bean->getMeta( 'type' );
|
||||
|
||||
foreach ( $ownAdditions as $addition ) {
|
||||
if ( $addition instanceof RedBean_OODBBean ) {
|
||||
|
||||
$myFieldLink = $beanType . '_id';
|
||||
$alias = $bean->getMeta( 'sys.alias.' . $addition->getMeta( 'type' ) );
|
||||
if ( $alias ) $myFieldLink = $alias . '_id';
|
||||
|
||||
$addition->$myFieldLink = $bean->id;
|
||||
$addition->setMeta( 'cast.' . $myFieldLink, 'id' );
|
||||
$this->store( $addition );
|
||||
|
|
Loading…
Reference in a new issue