<?php 
/*
* PuzzleApp
* Webemyos
* Jérôme Oliva
* GNU Licence
*/

namespace Apps\Cms\Entity;
use Core\Entity\Entity\Entity;
use Core\Entity\Entity\Property;
use Core\Entity\Entity\EntityProperty;

class CmsBlockItem extends Entity  
{
	//Constructeur
	function __construct($core)
	{
		//Version
		$this->Version ="2.0.0.0"; 

		//Nom de la table 
		$this->Core=$core; 
		$this->TableName="CmsBlockItem"; 
		$this->Alias = "CmsBlockItem"; 

		$this->BlockId = new Property("BlockId", "BlockId", NUMERICBOX,  true, $this->Alias); 
		$this->Name = new Property("Name", "Name", TEXTAREA,  true, $this->Alias); 
		$this->Url = new Property("Url", "Url", TEXTAREA,  true, $this->Alias); 

		//Creation de l entité 
		$this->Create(); 
	}

	    /***
     * Get elemnt in the current LAng
     */
    function GetLangElement(){
    
        if(!isset($this->LangElement)){
            
            $entityLangElement = \Apps\Lang\Helper\ElementHelper::GetEntityLangElement($this->Core,
            "CmsBlockItem", 
             $this->IdEntite, 
             $this->Core->GetLang("Id"));

             $this->LangElement = $entityLangElement;
        } 
    
        return $this->LangElement;
    }


    /***
     * Return name article in the current lang
     */
    function GetLangName(){

        $entityLangElement = $this->GetLangElement();
    
        if($entityLangElement){
            return $entityLangElement->Title->Value;
        }

        return $this->Name->Value;
    }
}
?>