PHP code example of prodigious / sonata-menu-bundle
1. Go to this page and download the library: Download prodigious/sonata-menu-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Prodigious\Sonata\MenuBundle\Model\Menu as BaseMenu;
/**
* Class Menu
*
* @ORM\Table(name="sonata_menu")
* @ORM\Entity(repositoryClass="AppBundle\Repository\Menu\MenuRepository")
*/
class Menu extends BaseMenu
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct();
}
public function getId(): ?int
{
return $this->id;
}
}
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Prodigious\Sonata\MenuBundle\Model\MenuItem as BaseMenuItem;
/**
* Class MenuItem
*
* @ORM\Table(name="sonata_menu_item")
* @ORM\Entity(repositoryClass="AppBundle\Repository\MenuItemRepository")
*/
class MenuItem extends BaseMenuItem
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*
* @ORM\Column(type="string", nullable=true)
*/
protected $icon;
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return string
*/
public function getIcon()
{
return $this->icon;
}
/**
* @param string $icon
* @return $this
*/
public function setIcon($icon)
{
$this->icon = $icon;
return $this;
}
}