Usage

Entities and Repositories
Limpid uses doctrine as ORM, so if you are familiar with doctrine this section should be easy for you. So, again, under your module create two directories called Entityand Repository.
Entity contains all entities related to database ex:
    
    namespace app\HelloLimpidModule\Entity;

    use Doctrine\ORM\Mapping as ORM;

    /**
     * Class Category
     *
     * @ORM\Entity(repositoryClass="app\HelloLimpidModule\Repository\CategoryRepository")//---Here you must mentione the related repository's location
     * @ORM\Table(name="categorie")
* */
class Category { /** * @var int * * @ORM\Column(name="idcategorie", 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="designation", type="string", length=255)
*/
private $designation; /** * @return int */ public function getId() { return $this->id; } /** * @param int $id */ public function setId($id) { $this->id = $id; return $this; } /** * @return string */ public function getTitle() { return $this->title; } /** * @param string $title */ public function setTitle($title) { $this->title = title; return $this; } /** * @return string */ public function getDesignation() { return $this->designation; } /** * @param string $designation */ public function setDesignation($designation) { $this->designation = $designation; return $this; } function __toString() { return $this->getDesignation(); } }
Repository contains all repositories related to each entity ex:
    namespace app\HelloLimpidModule\Repository;


    use Doctrine\ORM\EntityRepository;

    class CategoryRepository extends EntityRepository
    {
        //-----your custom queries goes here
    }
                
How to call these entities in my application ?
You can simply do this in your controller:
    namespace app\HelloLimpidModule\Controller;

    use framework\core\Controller\AppController;

    class DefaultController extends AppController
    {
        /**
         * My first command command
* As you can see you calld function should end with the word "Command"
* so Limpid can recognize it, and also to your code clear ;) */
public function myviewCommand($argument){ //--call getRepository function and give it the target entity to call //--findAll() is a function predefined by Doctrine that will get all the categories in the database
$categories = $this->getRepository('HelloLimpid:Category')->findAll(); $this->paintView('HelloLimpid:app.html.twig', array( 'arg' => $argument, 'categories' => $categories,//---you can pass the list as parameters to your view )); } }
And this is how to get your parameter from your view:
    <!--In your file app.html.twig-->
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="{{ assets('backoffice/css/style.css') }}" rel="stylesheet" type="text/css">
        <script src="{{ assets('backoffice/js/jquery-1.10.2.js') }}"></script>
        <title>{% block page_title %}{% endblock %}</title>
    </head>
    <body>
        {% for category in categories %}
            Title: {{ category.title }}<br>
            Designation: {{ category.designation }}
        {% endfor %}
    </body>
    </html>
                
Pretty simple.