Skip to content

dmozar/designer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minty

This is still a development of guidelines AND NOT FOR PRODUCTION

Powerful but easy php pattern designs framework. Minty framework has ORM framework inspired by the Doctrine 2 but is a lot easier and faster.

ORM Query Sample

public function getSpecifications( $type_id ){
        
        $query = new Query;
        
        $query->QueryConnect()
            ->Select(array(
                's.id, s.name, s.slug, s.status, s.position',
                't.id, t.name, t.slug, t.status, t.position'
            ))->From( self::AdSpecifications, 's')
            ->leftJoin( 's.type', 't' )
            ->orderBy('s.position', 'ASC');
        
        if($type_id)
            $query->addWhere ('t.id = :type_id')->addParameter ('type_id', $type_id);
        
        $QueryBuilder = $query->QueryBuilder( QueryBuilder::UseEventManager, $this, 'getSpecifications' );
        
        Cache::get($QueryBuilder, 'imedia_get_ad_specifications')->useRedisCache(3600);
        
        return $QueryBuilder->getResult( );
}

ORM Entity Sample

<?php namespace Imedia\RealEstate\Ad\Entity\Ad;

use Minty\MySql\ORM\Entity;
use Imedia\RealEstate\Ad\Entity\Ad\Type;

/**
 * @table="ad_specification"
 */
class Specification extends Entity {
    
    
    /**
     * @primary
     * @type="primary"
     * @cell="id"
     */
    public $id;

    /**
     *
     * @type="name"
     * @cell="name"
     */
    public $name;
    
    /**
     *
     * @type="string"
     * @cell="slug"
     */
    public $slug;
    
    /**
     *
     * @type="integer"
     * @cell="position"
     */
    public $position;
    
    /**
     *
     * @type="string"
     * @cell="status"
     */
    public $status;

    /**
     * @type="OneToOne"
     * @cell="type_id"
     * @target="Imedia\RealEstate\Ad\Entity\Ad\Type"
     * @relation="id"
     */
    public $type;
    
    /**
     * @type="OneToMany"
     * @target="Imedia\RealEstate\Ad\Entity\Ad\Filter"
     * @cell="id"
     * @relation="specification_id"
     */
    public $filters;
    
    
    public function __construct() {

    }

    public function getID(){ return $this->id; }
    public function getName(){ return $this->name; }
    public function setName( $name ){ $this->name = $name; }
    public function getSlug(){ return $this->slug; }
    public function setSlug( $slug ){ $this->slug = $slug; }
    public function getPosition(){ return $this->position; }
    public function setPosition( $position ){ $this->position = $position; }
    public function getStatus(){ return $this->status; }
    public function setStatus( $status ){ $this->status = $status ? 1 : 0; }
    public function getType(){ return $this->type; }
    public function setType( $type = null ){ $this->type = $type; }
    public function getFilters(){ return $this->filters; }
    
}

#Controller Sample

<?php namespace Imedia\RealEstate\Home\Controller;

use Imedia\RealEstate\Home\Module;
use Minty\View\ViewModel;


class HomeController extends Module {
    
    
    
    public function __construct() {
        parent::__construct();
        
        $this->register(__FILE__);
        
    }
    
    
    public function index(){
        
        $ServiceLocator = $this->getServiceLocator();
        
        $ViewModel =  $ServiceLocator->get('IndexHelper');
        
        return $ViewModel;
        
    }
    
}

#Configuration Sample

<?php


return [
    
    'routes' => [
        
        'home' => [
            'route' => '/',
            'constraints' => [
                
            ],
            'priority' => 1,
            'controller' => 'Imedia\RealEstate\Home\Controller\HomeController',
            'method' => 'index',
            'action' => 'http'
        ]
        
    ],
    'services' => [
        'RealEstateHomeService' => 'Imedia\RealEstate\Home\Service\RealEstateHomeService',
    ],
    
    'views' => [
        'index'     => __DIR__ . '/../view/master/index.phtml',
    ],
    'view_helpers' => [
        'IndexHelper' => 'Imedia\RealEstate\Home\View\IndexHelper'
    ],
    
    /**
     * Assets
     */
    'assets' => [
        'css' => [
            'real_estate_home.css'      => __DIR__ . '/../public/css/real_estate_home.css'
        ],
        'js' => [

        ],
    ]
    
];

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors