Skip to content

Instantly share code, notes, and snippets.

@Nek-
Created March 4, 2013 00:32
Show Gist options
  • Save Nek-/5079098 to your computer and use it in GitHub Desktop.
Save Nek-/5079098 to your computer and use it in GitHub Desktop.
Example of article compatible with NeklandFeedBundle
<?php
namespace Acme\ArticleBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Nekland\Bundle\FeedBundle\Item\ItemInterface;
/**
* Acme\ArticleBundle\Entity\Article
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Acme\ArticleBundle\Entity\ArticleRepository")
*/
class Article implements ItemInterface
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string $title
*
* @ORM\Column(name="title", type="string", length=255)
*/
private $title;
/**
* @var string $content
*
* @ORM\Column(name="content", type="text")
*/
private $content;
/**
* @var string $username
*
* @ORM\Column(name="username", type="string", length=255)
*/
private $username;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return Article
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set content
*
* @param string $content
* @return Article
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Set username
*
* @param string $username
* @return Article
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Get username
*
* @return string
*/
public function getUsername()
{
return $this->username;
}
public function getFeedTitle()
{
return $this->title;
}
public function getFeedDescription()
{
return $this->content;
}
public function getFeedRoutes()
{
return array(
array(
'route' => array(
'article_show',
array('id' => $this->id)
)
)
);
}
/**
* @return unique identifiant (for editing)
*/
public function getFeedId()
{
return $this->id;
}
/**
* @return \DateTime
*/
public function getFeedDate()
{
return new \DateTime();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment