PHP code example of gilles-hemmerle / symfony-crud-adminlte

1. Go to this page and download the library: Download gilles-hemmerle/symfony-crud-adminlte 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/ */

    

gilles-hemmerle / symfony-crud-adminlte example snippets


    
    // src/AppBundle/Entity/Article.php

    namespace AppBundle\Entity;

    use Doctrine\ORM\Mapping as ORM;

    /**
     * Articles
     *
     * @ORM\Table(name="article")
     * @ORM\Entity
     *
     */
    class Article
    {
        /**
         * @var string
         *
         * @ORM\Column(name="slug", type="string", length=120, nullable=false)
         */
        private $slug;

        /**
         * @var string
         *
         * @ORM\Column(name="article_title", type="string", length=120, nullable=false)
         */
        private $articleTitle;

        /**
         * @var string
         *
         * @ORM\Column(name="article_content", type="text")
         */
        private $articleContent;

        /**
         * @var integer
         *
         * @ORM\Column(name="id", type="integer")
         * @ORM\Id
         * @ORM\GeneratedValue(strategy="IDENTITY")
         */
        private $id;

        /**
         * @var \Doctrine\Common\Collections\Collection
         *
         * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Tag", inversedBy="articles")
         * @ORM\JoinTable(name="articles_tags")
         */
        private $tags;

        /**
         * Constructor
         */
        public function __construct()
        {
            $this->tags = new \Doctrine\Common\Collections\ArrayCollection();

        }

        public function __toString() {
            return $this->articleTitle;
        }
    }

    

    namespace AppBundle\Entity;

    use Doctrine\ORM\Mapping as ORM;

    /**
     * Articles
     *
     * @ORM\Table(name="tag")
     * @ORM\Entity
     *
     */
    class Tag
    {
        /**
         * @var string
         *
         * @ORM\Column(name="tag", type="string", length=45, nullable=false)
         */
        private $tag;

        /**
         * @var integer
         *
         * @ORM\Column(name="id", type="integer")
         * @ORM\Id
         * @ORM\GeneratedValue(strategy="IDENTITY")
         */
        private $id;

        /**
         * @var \Doctrine\Common\Collections\Collection
         *
         * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Article", mappedBy="tags")
         */
        private $articles;

        /**
         * Constructor
         */
        public function __construct()
        {
            $this->articles = new \Doctrine\Common\Collections\ArrayCollection();

        }

        public function __toString() {
            return $this->tag;
        }
    }
bash
php app/console fos:user:create user1
php app/console fos:user:promote user1 ROLE_ADMIN
bash
php app/console generate:doctrine:entities AppBundle:Article --no-backup
bash
php app/console generate:doctrine:entities AppBundle:Tag --no-backup