Conecciones de Promociones
This commit is contained in:
@ -204,4 +204,45 @@ class Promotion extends Common\Ideal\Repository
|
||||
throw new Common\Implement\Exception\EmptyResult($query, $exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model\Venta\Promotion $promotion
|
||||
* @param int $project_id
|
||||
* @return void
|
||||
* @throws PDOException
|
||||
*/
|
||||
public function insertProjectForPromotion(Model\Venta\Promotion $promotion, int $project_id): void
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->insert()
|
||||
->into('promotion_projects')
|
||||
->columns(['promotion_id', 'project_id'])
|
||||
->values([':promotion_id', ':project_id']);
|
||||
$this->connection->execute($query, ['promotion_id' => $promotion->id, 'project_id' => $project_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model\Venta\Promotion $promotion
|
||||
* @param int $contract_id
|
||||
* @return void
|
||||
* @throws PDOException
|
||||
*/
|
||||
public function insertContractForPromotion(Model\Venta\Promotion $promotion, int $contract_id): void
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->insert()
|
||||
->into('promotion_contracts')
|
||||
->columns(['promotion_id', 'contract_id'])
|
||||
->values([':promotion_id', ':contract_id']);
|
||||
$this->connection->execute($query, ['promotion_id' => $promotion->id, 'contract_id' => $contract_id]);
|
||||
}
|
||||
public function insertUnitForPromotion(Model\Venta\Promotion $promotion, int $unit_id): void
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->insert()
|
||||
->into('promotion_units')
|
||||
->columns(['promotion_id', 'unit_id'])
|
||||
->values([':promotion_id', ':unit_id']);
|
||||
$this->connection->execute($query, ['promotion_id' => $promotion->id, 'unit_id' => $unit_id]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user