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

Added sticky flag to News entity

Signed-off-by: Gergely Polonkai <polesz@w00d5t0ck.info>
master
Polonkai Gergely 10 years ago
parent 38f3f404d2
commit cf37eb1af3
  1. 29
      app/DoctrineMigrations/Version20120819121254.php
  2. 2
      src/KekRozsak/FrontBundle/Controller/NewsController.php
  3. 31
      src/KekRozsak/FrontBundle/Entity/News.php

@ -0,0 +1,29 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20120819121254 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 sticky TINYINT(1) NOT NULL");
$this->addSql("UPDATE news SET sticky = FALSE");
}
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 sticky");
}
}

@ -30,7 +30,7 @@ class NewsController extends Controller
$searchCriteria['public'] = true;
}
$news = $newsRepo->findBy($searchCriteria, array('createdAt' => 'DESC'), 4);
$news = $newsRepo->findBy($searchCriteria, array('sticky' => 'DESC', 'createdAt' => 'DESC'), 4);
return array(
'recentNews' => $news,

@ -197,4 +197,35 @@ class News
{
return $this->public;
}
/**
* TRUE if this News is "sticky" (it should be visible all the time)
*
* @var boolean $sticky
*
* @ORM\Column(type="boolean", nullable=false)
*/
protected $sticky;
/**
* Set sticky
*
* @param boolean $sticky
* @return News
*/
public function setSticky($sticky)
{
$this->sticky = $sticky;
return $this;
}
/**
* Get sticky
*
* @return boolean
*/
public function isSticky()
{
return $this->sticky;
}
}

Loading…
Cancel
Save