redbeanphp中的多对多关系不起作用

redbeanphp中的多对多关系不起作用,php,redbean,Php,Redbean,一家公司可以在多个领域开展业务,例如工程公司可以在结构、机器人、电子等领域开展业务 我有一个预设扇区表: $sectors = array('structural', 'robotics', 'environment'); // shortened as too long to post here foreach ($sectors as $sector){ $s = R::dispense( 'sector' ); $s->name = $sector; R::store

一家公司可以在多个领域开展业务,例如工程公司可以在结构、机器人、电子等领域开展业务

我有一个预设扇区表:

 $sectors = array('structural', 'robotics', 'environment'); // shortened as too long to post here

foreach ($sectors as $sector){
  $s = R::dispense( 'sector' );
  $s->name = $sector;
  R::store($s);  
}
我有一个公司表,当我从表格中选择一个或多个部门时,我想将其分配给公司:

  $sectors = array_keys($_POST['sectors']);

  foreach($sectors as $sector){ 
    echo $sector;
    //$s = R::findOne( 'sector',' name = ? ', "$sector" );
    $s  = R::findOne( 'sector', ' name = ? ', array($sector) );
    $company->sharedSectorList[] = $s); // seems to stop working here   
  }  

  // other stuff goes here
  $id = R::store( $company );
我的页面顶部有以下内容:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
但是,没有显示错误,只是显示HTTP错误500,目前无法处理此请求。它似乎在->sharedSectorList[]行停止工作。

arrr它是),我想…arrr它是),我想。。。