Skip to content

Commit

Permalink
Merge branch 'dev-rename-match'
Browse files Browse the repository at this point in the history
  • Loading branch information
rserry committed Oct 14, 2023
2 parents 7743c29 + aca2947 commit 08be303
Show file tree
Hide file tree
Showing 27 changed files with 157 additions and 156 deletions.
2 changes: 1 addition & 1 deletion module/BrBundle/Controller/Admin/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function statisticsAction()

$matchesCount = count(
$this->getEntityManager()
->getRepository('BrBundle\Entity\Event\Match')
->getRepository('BrBundle\Entity\Event\Connection')
->findAllByEvent($event)
);

Expand Down
60 changes: 30 additions & 30 deletions module/BrBundle/Controller/Admin/Match/MatchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace BrBundle\Controller\Admin\Match;

use BrBundle\Entity\Company;
use BrBundle\Entity\Match;
use BrBundle\Entity\Connection;
use BrBundle\Entity\Match\MatcheeMap\CompanyMatcheeMap;
use BrBundle\Entity\Match\MatcheeMap\StudentMatcheeMap;
use CommonBundle\Entity\User\Person;
Expand All @@ -21,7 +21,7 @@ class MatchController extends \CommonBundle\Component\Controller\ActionControlle
public function manageAction()
{
$matches = $this->getEntityManager()
->getRepository('BrBundle\Entity\Match')
->getRepository('BrBundle\Entity\Connection')
->findAll();

usort(
Expand All @@ -48,24 +48,24 @@ function ($a, $b) {

public function viewAction()
{
$match = $this->getMatchEntity();
if ($match === null) {
$m = $this->getMatchEntity();
if ($m === null) {
return new ViewModel();
}

$student = $match->getStudentMatchee()->getStudent();
$company = $match->getCompanyMatchee()->getCompany();
$student = $m->getStudentMatchee()->getStudent();
$company = $m->getCompanyMatchee()->getCompany();

$studentStudentFeatures = array();
$companyStudentFeatures = array();
// THE STUDENT FEATURES
foreach ($match->getStudentMatchee()->getStudentProfile()->getFeatures() as $feature) {
foreach ($m->getStudentMatchee()->getStudentProfile()->getFeatures() as $feature) {
$feat = (object) array();
$feat->name = $feature->getFeature()->getName();
$feat->importance = $feature->getImportance();
$studentStudentFeatures[$feature->getFeature()->getId()] = $feat;
}
foreach ($match->getCompanyMatchee()->getStudentProfile()->getFeatures() as $feature) {
foreach ($m->getCompanyMatchee()->getStudentProfile()->getFeatures() as $feature) {
$feat = (object) array();
$feat->name = $feature->getFeature()->getName();
$feat->importance = $feature->getImportance();
Expand All @@ -79,13 +79,13 @@ public function viewAction()
$studentCompanyFeatures = array();
$companyCompanyFeatures = array();
// THE COMPANY FEATURES
foreach ($match->getStudentMatchee()->getCompanyProfile()->getFeatures() as $feature) {
foreach ($m->getStudentMatchee()->getCompanyProfile()->getFeatures() as $feature) {
$feat = (object) array();
$feat->name = $feature->getFeature()->getName();
$feat->importance = $feature->getImportance();
$studentCompanyFeatures[$feature->getFeature()->getId()] = $feat;
}
foreach ($match->getCompanyMatchee()->getCompanyProfile()->getFeatures() as $feature) {
foreach ($m->getCompanyMatchee()->getCompanyProfile()->getFeatures() as $feature) {
$feat = (object) array();
$feat->name = $feature->getFeature()->getName();
$feat->importance = $feature->getImportance();
Expand All @@ -98,7 +98,7 @@ public function viewAction()

return new ViewModel(
array(
'match' => $match,
'match' => $m,
'student' => $student,
'company' => $company,
'studentStudentFeatures' => $studentStudentFeatures,
Expand Down Expand Up @@ -137,12 +137,12 @@ public function generateMatchesAction()

foreach ($allStudents as $student) {
foreach ($allCompanies as $company) {
$map = $this->getEntityManager()->getRepository('BrBundle\Entity\Match')
$map = $this->getEntityManager()->getRepository('BrBundle\Entity\Connection')
->findOneByStudentAndCompany($student, $company);
if ($map === null) {
$match = $this->generateMatch($student, $company);
if ($match !== null) {
$this->getEntityManager()->persist($match);
$m = $this->generateMatch($student, $company);
if ($m !== null) {
$this->getEntityManager()->persist($m);
}
}
}
Expand Down Expand Up @@ -210,7 +210,7 @@ public function sendMailCompaniesAction()
/**
* @param Person $student
* @param Company $company
* @return Match|null
* @return Connection|null
* @throws ORMException
*/
private function generateMatch(Person $student, Company $company)
Expand Down Expand Up @@ -255,26 +255,26 @@ private function generateMatch(Person $student, Company $company)
$this->getEntityManager()->persist($studentMatchee);


return new Match($studentMatchee, $companyMatchee);
return new Connection($studentMatchee, $companyMatchee);
}

public function deleteAction()
{
$this->initAjax();

$match = $this->getMatchEntity();
if ($match === null) {
$m = $this->getMatchEntity();
if ($m === null) {
return new ViewModel();
}
$this->getEntityManager()->remove($match);
$this->getEntityManager()->remove($m);

$this->getEntityManager()->flush();
$this->getEntityManager()->remove($match->getCompanyMatchee());
$this->getEntityManager()->remove($match->getStudentMatchee());
$this->getEntityManager()->remove($m->getCompanyMatchee());
$this->getEntityManager()->remove($m->getStudentMatchee());
$this->getEntityManager()->flush();
if (!is_null($match->getWave())) {
$match->getWave()->getWave()->removeMatch($match);
$this->getEntityManager()->remove($match->getWave());
if (!is_null($m->getWave())) {
$m->getWave()->getWave()->removeMatch($m);
$this->getEntityManager()->remove($m->getWave());
$this->getEntityManager()->flush();
}

Expand All @@ -288,7 +288,7 @@ public function deleteAction()
public function deleteAllAction()
{
$allMatches = $this->getEntityManager()
->getRepository('BrBundle\Entity\Match')
->getRepository('BrBundle\Entity\Connection')
->findAll();
foreach ($allMatches as $currentMatch)
{
Expand All @@ -308,13 +308,13 @@ public function deleteAllAction()
}

/**
* @return Match|null
* @return Connection|null
*/
private function getMatchEntity()
{
$match = $this->getEntityById('BrBundle\Entity\Match');
$m = $this->getEntityById('BrBundle\Entity\Connection');

if (!($match instanceof Match)) {
if (!($m instanceof Connection)) {
$this->flashMessenger()->error(
'Error',
'No match was found!'
Expand All @@ -330,7 +330,7 @@ private function getMatchEntity()
return;
}

return $match;
return $m;
}

public function sendMailToCompaniesAction(array $companies)
Expand Down
16 changes: 8 additions & 8 deletions module/BrBundle/Controller/Admin/Match/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ public function matchesAction()
$maps = $this->getEntityManager()->getRepository('BrBundle\Entity\Match\MatcheeMap\StudentMatcheeMap')
->findByStudent($studentMap->getStudent());
foreach ($maps as $map) {
$matches[] = $this->getEntityManager()->getRepository('BrBundle\Entity\Match')
$matches[] = $this->getEntityManager()->getRepository('BrBundle\Entity\Connection')
->findOneByStudentMatchee($map);
}
} elseif (!is_null($companyMap)) {
$maps = $this->getEntityManager()->getRepository('BrBundle\Entity\Match\MatcheeMap\CompanyMatcheeMap')
->findByCompany($companyMap->getCompany());
foreach ($maps as $map) {
$matches[] = $this->getEntityManager()->getRepository('BrBundle\Entity\Match')
$matches[] = $this->getEntityManager()->getRepository('BrBundle\Entity\Connection')
->findOneByCompanyMatchee($map);
}
}
Expand Down Expand Up @@ -145,7 +145,7 @@ public function addAction()
// $id = substr($key, strlen('feature_'));
// $map = new ProfileFeatureMap(
// $this->getEntityManager()
// ->getRepository('BrBundle\Entity\Match\Feature')
// ->getRepository('BrBundle\Entity\Connection\Feature')
// ->findOneById($id),$profile, $val);
// $this->getEntityManager()->persist($map);
// $profile->addFeature($map);
Expand Down Expand Up @@ -257,11 +257,11 @@ public function deleteAction()
}

$matches = $this->getEntityManager()
->getRepository('BrBundle\Entity\Match')
->getRepository('BrBundle\Entity\Connection')
->findAllByProfile($profile);

foreach ($matches as $match) {
$this->getEntityManager()->remove($match);
foreach ($matches as $m) {
$this->getEntityManager()->remove($m);
}

$this->getEntityManager()->remove($profile);
Expand All @@ -284,7 +284,7 @@ public function deleteAllCompanyProfilesAction()
foreach ($allCompanyProfiles as $companyProfile)
{
$matches = $this->getEntityManager()
->getRepository('BrBundle\Entity\Match')
->getRepository('BrBundle\Entity\Connection')
->findAllByProfile($companyProfile);

foreach ($matches as $match) {
Expand Down Expand Up @@ -314,7 +314,7 @@ public function deleteAllStudentProfilesAction()

foreach ($allStudentProfiles as $studentProfile) {
$matches = $this->getEntityManager()
->getRepository('BrBundle\Entity\Match')
->getRepository('BrBundle\Entity\Connection')
->findAllByProfile($studentProfile);

foreach ($matches as $match) {
Expand Down
18 changes: 9 additions & 9 deletions module/BrBundle/Controller/Admin/Match/WaveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ private function makeCompanyWave(Company $company, int $nb, Wave $wave)

$matches = array();
foreach ($maps as $m) {
$match = $this->getEntityManager()
->getRepository('BrBundle\Entity\Match')
$m = $this->getEntityManager()
->getRepository('BrBundle\Entity\Connection')
->findOneByCompanyMatchee($m);

if (!is_null($match)) {
$matches[] = $match;
if (!is_null($m)) {
$matches[] = $m;
}
}

Expand All @@ -277,18 +277,18 @@ function ($a, $b) {
$sizeMM = count($matches);

while ($i < $sizeMM && $n < $nb) {
$match = $matches[$i];
$m = $matches[$i];

if (!is_null($match->getWave())) {
if (!is_null($m->getWave())) {
$i += 1;
continue;
}
$n += 1;
$map = new Wave\WaveMatchMap($match, $cw);
$map = new Wave\WaveMatchMap($m, $cw);
$this->getEntityManager()->persist($map);
$cw->addMatch($map);
$match->setWave($map);
$match->setInterested(true);
$m->setWave($map);
$m->setInterested(true);
$i += 1;
}

Expand Down
Loading

0 comments on commit 08be303

Please sign in to comment.