diff --git a/app/Migrations/Schema/V200/Version20.php b/app/Migrations/Schema/V200/Version20.php index f4dc616443..a242b97e02 100644 --- a/app/Migrations/Schema/V200/Version20.php +++ b/app/Migrations/Schema/V200/Version20.php @@ -39,8 +39,8 @@ class Version20 extends AbstractMigrationChamilo $this->addSql('CREATE TABLE IF NOT EXISTS media__gallery_media (id INT AUTO_INCREMENT NOT NULL, gallery_id INT DEFAULT NULL, media_id INT DEFAULT NULL, position INT NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_80D4C5414E7AF8F (gallery_id), INDEX IDX_80D4C541EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); $this->addSql('CREATE TABLE IF NOT EXISTS media__gallery (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, context VARCHAR(64) NOT NULL, default_format VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); $this->addSql('CREATE TABLE IF NOT EXISTS media__media (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, provider_name VARCHAR(255) NOT NULL, provider_status INT NOT NULL, provider_reference VARCHAR(255) NOT NULL, provider_metadata LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', width INT DEFAULT NULL, height INT DEFAULT NULL, length NUMERIC(10, 0) DEFAULT NULL, content_type VARCHAR(255) DEFAULT NULL, content_size INT DEFAULT NULL, copyright VARCHAR(255) DEFAULT NULL, author_name VARCHAR(255) DEFAULT NULL, context VARCHAR(64) DEFAULT NULL, cdn_is_flushable TINYINT(1) DEFAULT NULL, cdn_flush_identifier VARCHAR(64) DEFAULT NULL, cdn_flush_at DATETIME DEFAULT NULL, cdn_status INT DEFAULT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_5C6DD74E12469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); - $this->addSql('CREATE TABLE IF NOT EXISTS faq_question_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, headline VARCHAR(255) NOT NULL, body LONGTEXT DEFAULT NULL, slug VARCHAR(50) NOT NULL, locale VARCHAR(255) NOT NULL, INDEX IDX_C2D1A2C2AC5D3 (translatable_id), UNIQUE INDEX faq_question_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); - $this->addSql('CREATE TABLE IF NOT EXISTS faq_category_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, headline VARCHAR(255) NOT NULL, body LONGTEXT DEFAULT NULL, slug VARCHAR(50) NOT NULL, locale VARCHAR(255) NOT NULL, INDEX IDX_5493B0FC2C2AC5D3 (translatable_id), UNIQUE INDEX faq_category_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); + $this->addSql('CREATE TABLE IF NOT EXISTS faq_question_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, headline VARCHAR(255) NOT NULL, body LONGTEXT DEFAULT NULL, slug VARCHAR(50) NOT NULL, locale VARCHAR(190) NOT NULL, INDEX IDX_C2D1A2C2AC5D3 (translatable_id), UNIQUE INDEX faq_question_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); + $this->addSql('CREATE TABLE IF NOT EXISTS faq_category_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, headline VARCHAR(255) NOT NULL, body LONGTEXT DEFAULT NULL, slug VARCHAR(50) NOT NULL, locale VARCHAR(190) NOT NULL, INDEX IDX_5493B0FC2C2AC5D3 (translatable_id), UNIQUE INDEX faq_category_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); $this->addSql('CREATE TABLE IF NOT EXISTS faq_category (id INT AUTO_INCREMENT NOT NULL, rank INT NOT NULL, is_active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX is_active_idx (is_active), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); $this->addSql('CREATE TABLE IF NOT EXISTS faq_question (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, rank INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, only_auth_users TINYINT(1) NOT NULL, is_active TINYINT(1) NOT NULL, INDEX IDX_4A55B05912469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); $this->addSql('CREATE TABLE IF NOT EXISTS contact_category_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, locale VARCHAR(255) NOT NULL, INDEX IDX_3E770F302C2AC5D3 (translatable_id), UNIQUE INDEX contact_category_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;'); @@ -133,6 +133,10 @@ class Version20 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE course_category ADD CONSTRAINT FK_AFF87497727ACA70 FOREIGN KEY (parent_id) REFERENCES course_category (id);'); $this->addSql('ALTER TABLE settings_current ADD CONSTRAINT FK_62F79C3B9436187B FOREIGN KEY (access_url) REFERENCES access_url (id);'); + $this->addSql('ALTER TABLE settings_current CHANGE variable variable VARCHAR(190) DEFAULT NULL, CHANGE subkey subkey VARCHAR(190) DEFAULT NULL;'); + $this->addSql('ALTER TABLE settings_options CHANGE variable variable VARCHAR(190) DEFAULT NULL, CHANGE value value VARCHAR(190) DEFAULT NULL'); + $this->addSql(' ALTER TABLE hook_event CHANGE class_name class_name VARCHAR(190) DEFAULT NULL;'); + $this->addSql('ALTER TABLE access_url_rel_session ADD id INT AUTO_INCREMENT NOT NULL, CHANGE access_url_id access_url_id INT DEFAULT NULL, CHANGE session_id session_id INT DEFAULT NULL, ADD PRIMARY KEY (id);'); $this->addSql('ALTER TABLE access_url_rel_session ADD CONSTRAINT FK_6CBA5F5D613FECDF FOREIGN KEY (session_id) REFERENCES session (id);'); diff --git a/src/CoreBundle/Entity/Block.php b/src/CoreBundle/Entity/Block.php index b5e2eed107..313fcb32d1 100644 --- a/src/CoreBundle/Entity/Block.php +++ b/src/CoreBundle/Entity/Block.php @@ -43,7 +43,7 @@ class Block /** * @var string * - * @ORM\Column(name="path", type="string", length=255, nullable=false) + * @ORM\Column(name="path", type="string", length=190, nullable=false) */ protected $path; diff --git a/src/CoreBundle/Entity/HookEvent.php b/src/CoreBundle/Entity/HookEvent.php index 7a944d93c9..3a4b2b7cc2 100644 --- a/src/CoreBundle/Entity/HookEvent.php +++ b/src/CoreBundle/Entity/HookEvent.php @@ -20,7 +20,7 @@ class HookEvent /** * @var string * - * @ORM\Column(name="class_name", type="string", length=255, nullable=true) + * @ORM\Column(name="class_name", type="string", length=190, nullable=true) */ protected $className; diff --git a/src/CoreBundle/Entity/HookObserver.php b/src/CoreBundle/Entity/HookObserver.php index 4e277e0bfe..8c0e240aa7 100644 --- a/src/CoreBundle/Entity/HookObserver.php +++ b/src/CoreBundle/Entity/HookObserver.php @@ -20,7 +20,7 @@ class HookObserver /** * @var string * - * @ORM\Column(name="class_name", type="string", length=255, nullable=true) + * @ORM\Column(name="class_name", type="string", length=190, nullable=true) */ protected $className; diff --git a/src/CoreBundle/Entity/SettingsCurrent.php b/src/CoreBundle/Entity/SettingsCurrent.php index 8443879017..59c3549b55 100644 --- a/src/CoreBundle/Entity/SettingsCurrent.php +++ b/src/CoreBundle/Entity/SettingsCurrent.php @@ -39,14 +39,14 @@ class SettingsCurrent /** * @var string * - * @ORM\Column(name="variable", type="string", length=255, nullable=true) + * @ORM\Column(name="variable", type="string", length=190, nullable=true) */ protected $variable; /** * @var string * - * @ORM\Column(name="subkey", type="string", length=255, nullable=true) + * @ORM\Column(name="subkey", type="string", length=190, nullable=true) */ protected $subkey; diff --git a/src/CoreBundle/Entity/SettingsOptions.php b/src/CoreBundle/Entity/SettingsOptions.php index 4f4289b4d0..60a60d4e2a 100644 --- a/src/CoreBundle/Entity/SettingsOptions.php +++ b/src/CoreBundle/Entity/SettingsOptions.php @@ -29,7 +29,7 @@ class SettingsOptions /** * @var string * - * @ORM\Column(name="variable", type="string", length=255, nullable=true) + * @ORM\Column(name="variable", type="string", length=190, nullable=true) */ protected $variable; diff --git a/src/CourseBundle/Entity/CDropboxFile.php b/src/CourseBundle/Entity/CDropboxFile.php index d08dacaa31..c0fbfb1ea5 100644 --- a/src/CourseBundle/Entity/CDropboxFile.php +++ b/src/CourseBundle/Entity/CDropboxFile.php @@ -56,7 +56,7 @@ class CDropboxFile /** * @var string * - * @ORM\Column(name="filename", type="string", length=250, nullable=false) + * @ORM\Column(name="filename", type="string", length=190, nullable=false) */ protected $filename; diff --git a/src/FaqBundle/Entity/Category.php b/src/FaqBundle/Entity/Category.php index a9edd5c67e..8285e294d0 100644 --- a/src/FaqBundle/Entity/Category.php +++ b/src/FaqBundle/Entity/Category.php @@ -10,7 +10,7 @@ use Knp\DoctrineBehaviors\Model as ORMBehaviors; /** * Class Category. * - * @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Entity\CategoryRepository") + * @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Repository\CategoryRepository") * @ORM\Table( * name="faq_category", * indexes={@ORM\Index(name="is_active_idx", columns={"is_active"})} diff --git a/src/FaqBundle/Entity/CategoryRepository.php b/src/FaqBundle/Entity/CategoryRepository.php deleted file mode 100755 index ad8a4f2a7f..0000000000 --- a/src/FaqBundle/Entity/CategoryRepository.php +++ /dev/null @@ -1,83 +0,0 @@ -createQueryBuilder('c') - ->where('c.isActive = :isActive') - ->orderBy('c.rank', 'ASC') - ->getQuery(); - - $query->setParameter('isActive', true); - - return $query->execute(); - } - - /** - * @param string $slug - * - * @return mixed - */ - public function retrieveActiveBySlug($slug) - { - $query = $this->createQueryBuilder('c') - ->where('c.isActive = :isActive') - ->andWhere('c.slug = :slug') - ->orderBy('c.rank', 'ASC') - ->getQuery(); - - $query->setParameter('isActive', true); - $query->setParameter('slug', $slug); - - return $query->execute(); - } - - /** - * @param string $slug - * - * @return mixed - */ - public function getCategoryActiveBySlug($slug) - { - $query = $this->createQueryBuilder('c') - ->join('c.translations', 't') - ->where('c.isActive = :isActive') - ->andWhere('t.slug = :slug') - ->getQuery(); - - $query->setParameter('isActive', true); - $query->setParameter('slug', $slug); - - return $query->getOneOrNullResult(); - } - - /** - * @return Category|null - */ - public function retrieveFirst() - { - $query = $this->createQueryBuilder('c') - ->where('c.isActive = :isActive') - ->orderBy('c.rank', 'ASC') - ->setMaxResults(1) - ->getQuery(); - - $query->setParameter('isActive', true); - - return $query->getOneOrNullResult(); - } -} diff --git a/src/FaqBundle/Entity/CategoryTranslation.php b/src/FaqBundle/Entity/CategoryTranslation.php index 17af06735e..e639d89b69 100644 --- a/src/FaqBundle/Entity/CategoryTranslation.php +++ b/src/FaqBundle/Entity/CategoryTranslation.php @@ -15,6 +15,15 @@ use Knp\DoctrineBehaviors\Model as ORMBehaviors; * name="faq_category_translation", * options={"row_format":"DYNAMIC"} * ) + * @ORM\AttributeOverrides({ + * @ORM\AttributeOverride(name="locale", + * column=@ORM\Column( + * name="locale", + * type="string", + * length=190 + * ) + * ) + * }) * * @package Chamilo\FaqBundle\Entity */ @@ -38,6 +47,15 @@ class CategoryTranslation */ protected $slug; + /** + * @var string + * @ORM\Column(type="string", length=190, nullable=false) + */ + protected $locale; + + /** + * @return string + */ public function __toString() { return (string) $this->headline; diff --git a/src/FaqBundle/Entity/Question.php b/src/FaqBundle/Entity/Question.php index 7611e7ad46..2e6902937e 100644 --- a/src/FaqBundle/Entity/Question.php +++ b/src/FaqBundle/Entity/Question.php @@ -10,7 +10,7 @@ use Knp\DoctrineBehaviors\Model as ORMBehaviors; /** * Class Question. * - * @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Entity\QuestionRepository") + * @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Repository\QuestionRepository") * @ORM\Table(name="faq_question") * * * diff --git a/src/FaqBundle/Entity/QuestionRepository.php b/src/FaqBundle/Entity/QuestionRepository.php deleted file mode 100755 index 0acfe645d5..0000000000 --- a/src/FaqBundle/Entity/QuestionRepository.php +++ /dev/null @@ -1,53 +0,0 @@ -createQueryBuilder('q') - ->join('q.category', 'c') - ->join('c.translations', 't') - ->where('t.slug = :categorySlug') - ->orderBy('q.rank', 'ASC') - ->setMaxResults(1) - ->getQuery(); - - $query->setParameter('categorySlug', $categorySlug); - - return $query->getOneOrNullResult(); - } - - /** - * @param string $slug - * - * @return Question|null - */ - public function getQuestionBySlug($slug) - { - $query = $this->createQueryBuilder('q') - ->join('q.translations', 't') - ->where('t.slug = :slug') - ->orderBy('q.rank', 'ASC') - ->setMaxResults(1) - ->getQuery(); - - $query->setParameter('slug', $slug); - - return $query->getOneOrNullResult(); - } -} diff --git a/src/FaqBundle/Entity/QuestionTranslation.php b/src/FaqBundle/Entity/QuestionTranslation.php index 220134b10f..5f07c89a3a 100644 --- a/src/FaqBundle/Entity/QuestionTranslation.php +++ b/src/FaqBundle/Entity/QuestionTranslation.php @@ -16,6 +16,16 @@ use Knp\DoctrineBehaviors\Model as ORMBehaviors; * options={"row_format":"DYNAMIC"} * ) * + * @ORM\AttributeOverrides({ + * @ORM\AttributeOverride(name="locale", + * column=@ORM\Column( + * name="locale", + * type="string", + * length=190 + * ) + * ) + * }) + * * @package Chamilo\FaqBundle\Entity */ class QuestionTranslation @@ -38,6 +48,12 @@ class QuestionTranslation */ protected $slug; + /** + * @var string + * @ORM\Column(type="string", length=190, nullable=false) + */ + protected $locale; + /** * @return string */