Add group - course entity connection

pull/2635/head
Julio Montoya 6 years ago
parent 6fb65e13e8
commit c9848ba4b5
  1. 2
      app/Migrations/Schema/V200/Version20.php
  2. 8
      src/CoreBundle/Entity/Course.php

@ -584,6 +584,8 @@ class Version20 extends AbstractMigrationChamilo
if (!$table->hasColumn('author_id')) {
$this->addSql('ALTER TABLE usergroup ADD author_id INT DEFAULT NULL');
}
$this->addSql('ALTER TABLE c_group_info ADD CONSTRAINT FK_CE06532491D79BD3 FOREIGN KEY (c_id) REFERENCES course (id);');
}
/**

@ -546,7 +546,7 @@ class Course
public function hasTeacher(User $user)
{
$criteria = Criteria::create()->where(
Criteria::expr()->eq("user", $user)
Criteria::expr()->eq('user', $user)
);
return $this->getTeachers()->matching($criteria)->count() > 0;
@ -559,9 +559,9 @@ class Course
*/
public function hasGroup(CGroupInfo $group)
{
$criteria = Criteria::create()->where(
Criteria::expr()->eq("groups", $group)
);
/*$criteria = Criteria::create()->where(
Criteria::expr()->eq('groups', $group)
);*/
return $this->getGroups()->contains($group);
}

Loading…
Cancel
Save