Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
src/Chamilo/CoreBundle/Entity/AccessUrlRelUserGroup.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
|
||
namespace Chamilo\CoreBundle\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* AccessUrlRelUser | ||
* | ||
* @ORM\Table(name="access_url_rel_usergroup") | ||
* @ORM\Entity | ||
*/ | ||
class AccessUrlRelUserGroup | ||
{ | ||
/** | ||
* @var integer | ||
* | ||
* @ORM\Column(name="id", type="integer") | ||
* @ORM\Id | ||
* @ORM\GeneratedValue() | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @var integer | ||
* | ||
* @ORM\Column(name="access_url_id", type="integer") | ||
*/ | ||
private $accessUrlId; | ||
|
||
/** | ||
* @var integer | ||
* | ||
* @ORM\Column(name="usergroup_id", type="integer") | ||
*/ | ||
private $userGroupId; | ||
|
||
|
||
/** | ||
* Set accessUrlId | ||
* | ||
* @param integer $accessUrlId | ||
* @return AccessUrlRelUser | ||
*/ | ||
public function setAccessUrlId($accessUrlId) | ||
{ | ||
$this->accessUrlId = $accessUrlId; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get accessUrlId | ||
* | ||
* @return integer | ||
*/ | ||
public function getAccessUrlId() | ||
{ | ||
return $this->accessUrlId; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @param int $id | ||
* @return AccessUrlRelUserGroup | ||
*/ | ||
public function setId($id) | ||
{ | ||
$this->id = $id; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getUserGroupId() | ||
{ | ||
return $this->userGroupId; | ||
} | ||
|
||
/** | ||
* @param int $userGroupId | ||
* @return AccessUrlRelUserGroup | ||
*/ | ||
public function setUserGroupId($userGroupId) | ||
{ | ||
$this->userGroupId = $userGroupId; | ||
|
||
return $this; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150522112023.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/* For licensing terms, see /license.txt */ | ||
|
||
namespace Chamilo\CoreBundle\Migrations\Schema\V110; | ||
|
||
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; | ||
use Doctrine\DBAL\Schema\Schema; | ||
|
||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
class Version20150522112023 extends AbstractMigrationChamilo | ||
{ | ||
/** | ||
* @param Schema $schema | ||
*/ | ||
public function up(Schema $schema) | ||
{ | ||
if (!$schema->hasTable('access_url_rel_usergroup')) { | ||
$this->addSql( | ||
'CREATE TABLE access_url_rel_usergroup (id INT UNSIGNED AUTO_INCREMENT NOT NULL, access_url_id INT UNSIGNED NOT NULL, usergroup_id INT UNSIGNED NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB' | ||
); | ||
$sql = 'SELECT * FROM usergroup'; | ||
$result = $this->connection->query($sql); | ||
$results = $result->fetchAll(); | ||
foreach ($results as $result) { | ||
$groupId = $result['id']; | ||
$sql = "INSERT INTO access_url_rel_usergroup (access_url_id, usergroup_id) VALUES ('1', '$groupId')"; | ||
$this->addSql($sql); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @param Schema $schema | ||
*/ | ||
public function down(Schema $schema) | ||
{ | ||
$this->addSql('DROP TABLE access_url_rel_usergroup'); | ||
} | ||
} |