Skip to content

Instantly share code, notes, and snippets.

@nicosomb
Last active August 29, 2015 14:13
Show Gist options
  • Save nicosomb/148e47be5261636c175b to your computer and use it in GitHub Desktop.
Save nicosomb/148e47be5261636c175b to your computer and use it in GitHub Desktop.
pbm de requête
{% block content %}
test
{% for entry in entries %}
<div id="entry-{{ entry.id|e }}" class="entrie">
<h2><a href="index.php?view=view&amp;id={{ entry.id|e }}">{{ entry.title|raw }}</a></h2>
{% if entry.content| readingTime > 0 %}
<div class="estimatedTime"><span class="tool reading-time">{% trans %}estimated reading time :{% endtrans %} {{ entry.content| readingTime }} min</span></div>
{% else %}
<div class="estimatedTime"><span class="tool reading-time">{% trans %}estimated reading time :{% endtrans %} <small class="inferieur">&lt;</small> 1 min</span></div>
{% endif %}
<ul class="tools links">
<li><a title="{% trans %}Toggle mark as read{% endtrans %}" class="tool icon-check icon {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="./?action=toggle_archive&amp;id={{ entry.id|e }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
<li><a title="{% trans %}toggle favorite{% endtrans %}" class="tool icon-star icon {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="./?action=toggle_fav&amp;id={{ entry.id|e }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li>
<li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans %}delete{% endtrans %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.url | e | domainName }}</span></a></li>
</ul>
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
</div>
{% endfor %}
{% endblock %}
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Entry
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="WallabagBundle\Entity\EntryRepository")
*/
class Entry
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="url", type="text")
*/
private $url;
/**
* @var string
*
* @ORM\Column(name="content", type="text")
*/
private $content;
/**
* @var boolean
*
* @ORM\Column(name="is_read", type="boolean")
*/
private $isRead;
/**
* @var boolean
*
* @ORM\Column(name="is_fav", type="boolean")
*/
private $isFav;
/**
* @var \DateTime
*
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @var \DateTime
*
* @ORM\Column(name="edited_at", type="datetime")
*/
private $editedAt;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return Entry
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set url
*
* @param string $url
* @return Entry
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* Get url
*
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set content
*
* @param string $content
* @return Entry
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Set isRead
*
* @param boolean $isRead
* @return Entry
*/
public function setIsRead($isRead)
{
$this->isRead = $isRead;
return $this;
}
/**
* Get isRead
*
* @return boolean
*/
public function getIsRead()
{
return $this->isRead;
}
/**
* Set isFav
*
* @param boolean $isFav
* @return Entry
*/
public function setIsFav($isFav)
{
$this->isFav = $isFav;
return $this;
}
/**
* Get isFav
*
* @return boolean
*/
public function getIsFav()
{
return $this->isFav;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
* @return Entry
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set editedAt
*
* @param \DateTime $editedAt
* @return Entry
*/
public function setEditedAt($editedAt)
{
$this->editedAt = $editedAt;
return $this;
}
/**
* Get editedAt
*
* @return \DateTime
*/
public function getEditedAt()
{
return $this->editedAt;
}
}
<?php
// ...
$repository = $this
->getDoctrine()
->getManager()
->getRepository('WallabagBundle:Entry')
;
$entries = $repository->findAll();
return $this->render(
'WallabagBundle:Entry:entries.html.twig',
array('entries' => $entries)
);
SELECT
t0.id AS id1,
t0.title AS title2,
t0.url AS url3,
t0.content AS content4,
t0.is_read AS is_read5,
t0.is_fav AS is_fav6,
t0.created_at AS created_at7,
t0.edited_at AS edited_at8
FROM
Entry t0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment