|
|
@@ -25,8 +25,8 @@ class ConstraintEntity extends \Entity
|
|
|
**/
|
|
|
public static function create($cId, $userA, $userB)
|
|
|
{
|
|
|
- $query = self::getPdo()->prepare("INSERT INTO `users` (`campain`, `userA`, `userB`) VALUES(?, ?, ?)");
|
|
|
- return ($query->execute(array($cId, $userA, $userB)));
|
|
|
+ $query = self::getPdo()->prepare("INSERT INTO `userConstraints` (`campain`, `userA`, `userB`) VALUES(?, ?, ?)");
|
|
|
+ return ($query->execute(array($cId, $userA->getEmail(), $userB->getEmail())));
|
|
|
}
|
|
|
|
|
|
public static function getForCampain($cId)
|
|
|
@@ -38,5 +38,11 @@ class ConstraintEntity extends \Entity
|
|
|
$result[] = new self($i);
|
|
|
return $result;
|
|
|
}
|
|
|
+
|
|
|
+ public static function removeForCampain($cId)
|
|
|
+ {
|
|
|
+ $cId = (int) $cId;
|
|
|
+ self::getPdo()->exec("DELETE FROM `userConstraints` WHERE `campain`={$cId}");
|
|
|
+ }
|
|
|
}
|
|
|
|