Created
April 26, 2012 19:06
-
-
Save patie/2502050 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Author: Patrik Gmitter <[email protected]> | |
* Date: 4/24/12 | |
*/ | |
namespace Model; | |
use Doctrine\ORM\Mapping as ORM, | |
Doctrine\ORM\Proxy, | |
Doctrine\Common\Collections; | |
/** | |
* @ORM\Entity | |
* @ORM\Table(name="blogcategory") | |
*/ | |
class BlogCategory extends \Nette\Object | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue | |
*/ | |
protected $id; | |
/** | |
* @ORM\Column(type="integer", nullable=true) | |
*/ | |
protected $blogcategory_id; | |
/** | |
* @ORM\Column(type="string") | |
*/ | |
protected $title; | |
/** | |
* @ORM\Column(type="string") | |
*/ | |
protected $slug; | |
/** | |
* @ORM\Column(type="text") | |
*/ | |
protected $description; | |
/** | |
* @ORM\Column(type="integer") | |
*/ | |
protected $status; | |
/** | |
* @ORM\ManyToOne(targetEntity="BlogCategory", inversedBy="id", cascade={"persist", "remove"}) | |
* @ORM\JoinColumn(name="blogcategory_id", referencedColumnName="id", onDelete="CASCADE") | |
*/ | |
protected $parent; | |
/** | |
* @ORM\OneToMany(targetEntity="BlogCategory", mappedBy="parent", cascade={"persist", "remove"}, orphanRemoval=true) | |
* @ORM\OrderBy({"id" = "ASC"}) | |
*/ | |
protected $childrens; | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->childrens = new \Doctrine\Common\Collections\ArrayCollection(); | |
} | |
public function getId() | |
{ | |
return $this->id; | |
} | |
public function getTitle() | |
{ | |
return $this->title; | |
} | |
public function getChildrens() | |
{ | |
return $this->childrens; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* kategoria 1 | |
* kategoria 2 | |
* kategoria 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{block #menu} | |
<ul class="control menu"> | |
<li n:foreach="$navigation as $item"> | |
{if count($item->childrens)>0 } | |
<span class="active"><strong>{$item->title}</strong></span> | |
{include #menu, navigation => $item->childrens} | |
{else} | |
<span class="active"><strong>{$item->title}</strong></span> | |
{/if} | |
</li> | |
</ul> | |
{/block} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment