Add ExtraFieldRelTag table - refs BT#9884 #TMI

1.10.x
Angel Fernando Quiroz Campos 11 years ago
parent 85951db713
commit 45ae0e3860
  1. 1
      main/inc/lib/database.constants.inc.php
  2. 118
      src/Chamilo/CoreBundle/Entity/ExtraFieldRelTag.php
  3. 68
      src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150608104600.php

@ -78,6 +78,7 @@ define('TABLE_MAIN_CALENDAR_EVENT_VALUES', 'calendar_event_values');*/
//User tags
define('TABLE_MAIN_TAG', 'tag');
define('TABLE_MAIN_USER_REL_TAG', 'user_rel_tag');
define('TABLE_MAIN_EXTRA_FIELD_REL_TAG', 'extra_field_rel_tag');
//User groups
/*define('TABLE_MAIN_GROUP', 'groups');

@ -0,0 +1,118 @@
<?php
namespace Chamilo\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* FieldRelTag
*
* @ORM\Table(name="extra_field_rel_tag")
* @ORM\Entity
*/
class ExtraFieldRelTag
{
/**
* @var integer
*
* @ORM\Column(name="field_id", type="integer", nullable=false)
*/
private $fieldId;
/**
* @var integer
*
* @ORM\Column(name="tag_id", type="integer", nullable=false)
*/
private $tagId;
/**
* @var integer
*
* @ORM\Column(name="item_id", type="integer", nullable=false)
*/
private $itemId;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* Set fieldId
* @param integer $fieldId
* @return \Chamilo\CoreBundle\Entity\ExtraFieldRelTag
*/
public function setFieldId($fieldId)
{
$this->fieldId = $fieldId;
return $this;
}
/**
* Set tagId
* @param integer $tagId
* @return \Chamilo\CoreBundle\Entity\ExtraFieldRelTag
*/
public function setTagId($tagId)
{
$this->tagId = $tagId;
return $this;
}
/**
* Set itemId
* @param integer $itemId
* @return \Chamilo\CoreBundle\Entity\ExtraFieldRelTag
*/
public function setItemId($itemId)
{
$this->itemId = $itemId;
return $this;
}
/**
* Get fieldId
*
* @return integer
*/
public function getFieldId()
{
return $this->fieldId;
}
/**
* Get tagId
* @return integer
*/
public function getTagId()
{
return $this->tagId;
}
/**
* Get itemId
* @return integer
*/
public function getItemId()
{
return $this->itemId;
}
/**
* Get id
* @return integer
*/
public function getId()
{
return $this->id;
}
}

@ -0,0 +1,68 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Migrations\Schema\V110;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type as TableColumnType;
/**
* Session date changes
*/
class Version20150608104600 extends AbstractMigrationChamilo
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$extraFieldRelTag = $schema->createTable('extra_field_rel_tag');
$extraFieldRelTag->addColumn(
'id',
TableColumnType::INTEGER,
['unsigned' => true, 'autoincrement' => true, 'notnull' => true]
);
$extraFieldRelTag->addColumn(
'field_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$extraFieldRelTag->addColumn(
'item_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$extraFieldRelTag->addColumn(
'tag_id',
TableColumnType::INTEGER,
['unsigned' => true, 'notnull' => true]
);
$extraFieldRelTag->setPrimaryKey(['id']);
$extraFieldRelTag->addIndex(
['field_id'],
'idx_frt_field'
);
$extraFieldRelTag->addIndex(
['item_id'],
'idx_frt_item'
);
$extraFieldRelTag->addIndex(
['tag_id'],
'idx_frt_tag'
);
$extraFieldRelTag->addIndex(
['field_id', 'item_id', 'tag_id'],
'idx_frt_field_item_tag'
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema->dropTable('extra_field_rel_tag');
}
}
Loading…
Cancel
Save