The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Added a slug property to the News entity

Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
master
Gergely POLONKAI (W00d5t0ck) 10 years ago
parent 17bf54b4d6
commit dfeed19fa7
  1. 30
      app/DoctrineMigrations/Version20120901231931.php
  2. 31
      src/KekRozsak/FrontBundle/Entity/News.php

@ -0,0 +1,30 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20120901231931 extends AbstractMigration
{
public function up(Schema $schema)
{
// this up() migration is autogenerated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->addSql("ALTER TABLE news ADD slug VARCHAR(100) NOT NULL");
$this->addSql("UPDATE news SET slug = title");
$this->addSql("CREATE UNIQUE INDEX UNIQ_1DD39950989D9B62 ON news (slug)");
}
public function down(Schema $schema)
{
// this down() migration is autogenerated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->addSql("ALTER TABLE news DROP slug");
}
}

@ -72,6 +72,37 @@ class News
return $this->title;
}
/**
* The slugified title of this News
*
* @var string $slug
*
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
protected $slug;
/**
* Set slug
*
* @param string $slug
* @return News
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* The contents of this News
*

Loading…
Cancel
Save