public function getQueryToSelect()
 {
     $result = $this->_repoAggWarehouse->getQueryToSelect();
     /* aliases and tables */
     $asStock = WrhsRepoAggWarehouse::AS_STOCK;
     $asOdoo = IWarehouse::AS_ODOO;
     $tblOdoo = [$asOdoo => $this->_resource->getTableName(EntityWarehouse::ENTITY_NAME)];
     /* LEFT JOIN prxgt_odoo_wrhs */
     $cols = [AggWarehouse::AS_ODOO_ID => EntityWarehouse::ATTR_ODOO_REF];
     $cond = $asOdoo . '.' . EntityWarehouse::ATTR_MAGE_REF . '=' . $asStock . '.' . Cfg::E_CATINV_STOCK_A_STOCK_ID;
     $result->joinLeft($tblOdoo, $cond, $cols);
     return $result;
 }
 /** @inheritdoc */
 public function create($data)
 {
     /** @var  $result AggWarehouse */
     $result = null;
     $def = $this->_manTrans->begin();
     try {
         $wrhsData = $this->_repoWrhsAggWarehouse->create($data);
         /* create odoo related entries */
         $bind = [EntityWarehouse::ATTR_MAGE_REF => $wrhsData->getId(), EntityWarehouse::ATTR_ODOO_REF => $data->getOdooId()];
         $this->_repoEntityWarehouse->create($bind);
         $this->_manTrans->commit($def);
         /* compose result from warehouse module's data and odoo module's data */
         $result = $this->_manObj->create(AggWarehouse::class);
         $result->setData($wrhsData);
         $result->setOdooId($data->getOdooId());
     } finally {
         $this->_manTrans->end($def);
     }
     return $result;
 }
 public function test_getQueryToSelectCount()
 {
     /** === Test Data === */
     $query = 'query';
     /** === Setup Mocks === */
     // $result = $this->_factorySelect->getQueryToSelectCount();
     $this->mFactorySelect->shouldReceive('getQueryToSelectCount')->once()->andReturn($query);
     /** === Call and asserts  === */
     $res = $this->obj->getQueryToSelectCount();
     $this->assertEquals($query, $res);
 }