Exemplo n.º 1
0
 /**
  * Returns a field collection
  *
  * @param mixed  $entity ElggEntity or an array of entity attributes
  * @param string $action Action name (used as a plugin hook type)
  * @param array  $params Additional context params to pass to the hook
  * @return \hypeJunction\Prototyper\Elements\FieldCollection
  */
 public function fields($entity = array(), $action = 'all', array $params = array())
 {
     $fieldCollection = array();
     $entity = $this->entityFactory->build($entity);
     if ($entity instanceof \ElggEntity) {
         $params['entity'] = $entity;
         $fields = (array) elgg_trigger_plugin_hook('prototype', $action, $params, array());
         $attribute_names = $this->entityFactory->getAttributeNames($entity);
         if (!$entity->guid) {
             $fields['type'] = array('type' => 'hidden');
             $fields['subtype'] = array('type' => 'hidden');
             $fields['owner_guid'] = array('type' => 'hidden');
             $fields['container_guid'] = array('type' => 'hidden');
         } else {
             $fields['guid'] = array('type' => 'hidden');
         }
         foreach ($fields as $shortname => $field) {
             $field['entity_type'] = $entity->getType();
             $field['entity_subtype'] = $entity->getSubtype();
             if (empty($field['shortname'])) {
                 $field['shortname'] = $shortname;
             }
             if (in_array($shortname, $attribute_names)) {
                 $field['data_type'] = 'attribute';
                 $field['class_name'] = Elements\AttributeField::CLASSNAME;
             }
             $fieldObj = $this->fieldFactory->build($field);
             if ($fieldObj instanceof Elements\Field) {
                 $fieldCollection[] = $fieldObj;
             }
         }
     }
     return new Elements\FieldCollection($fieldCollection);
 }
Exemplo n.º 2
0
 /**
  * init module from data
  *
  * @param array $data
  * @return $this
  */
 public function initFromData(array $data)
 {
     if (isset($data[$this->getEntityCode()])) {
         $this->addData($data[$this->getEntityCode()]);
     }
     $settings = $this->settingsFactory->create();
     if (isset($data[$settings->getEntityCode()])) {
         $settings->setData($data[$settings->getEntityCode()]);
         $this->setSettings($settings);
     }
     $entitiesByIndex = [];
     if (isset($data['entity'])) {
         $entities = $data['entity'];
         if (is_array($entities)) {
             foreach ($entities as $key => $entityData) {
                 if (!$entityData) {
                     continue;
                 }
                 /** @var \Umc\Base\Model\Core\Entity $entity */
                 $entity = $this->entityFactory->create();
                 if (isset($entityData['attributes']) && is_array($entityData['attributes'])) {
                     if (isset($entityData['attributes']['is_name'])) {
                         $isName = $entityData['attributes']['is_name'];
                         unset($entityData['attributes']['is_name']);
                         if (isset($entityData['attributes'][$isName])) {
                             $entityData['attributes'][$isName]['is_name'] = 1;
                         }
                     }
                     foreach ($entityData['attributes'] as $attrKey => $attributeData) {
                         /** @var \Umc\Base\Model\Core\Attribute $attribute */
                         $attribute = $this->attributeFactory->create();
                         $attribute->addData($attributeData);
                         $attribute->setIndex($attrKey);
                         $entity->addAttribute($attribute);
                     }
                 }
                 unset($data['attribute']);
                 $entity->addData($entityData);
                 $entity->setIndex($key);
                 $this->addEntity($entity);
                 $entitiesByIndex[$key] = $entity;
             }
         }
     }
     if (isset($data['relation'])) {
         foreach ($data['relation'] as $index => $values) {
             foreach ($values as $jndex => $type) {
                 if (isset($entitiesByIndex[$index]) && isset($entitiesByIndex[$jndex])) {
                     /** @var \Umc\Base\Model\Core\Relation $relation */
                     $relation = $this->relationFactory->create();
                     $relation->setEntities($entitiesByIndex[$index], $entitiesByIndex[$jndex], $type);
                     $this->addRelation($relation);
                 }
             }
         }
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * @param ActiveRow $row
  */
 protected function getEntity($row)
 {
     if (!$row) {
         return $row;
     }
     $id = $row->getSignature(TRUE);
     if (!isset($this->data[$id])) {
         $this->data[$id] = $this->entityFactory->create($this->type, $row, $this);
     }
     return $this->data[$id];
 }
Exemplo n.º 4
0
 public function getCellFreeArea($cell)
 {
     $cellInfo = $this->getOneItem($cell);
     $freeArea = $cellInfo['area'];
     $cellProducts = $this->getCellProducts($cell);
     if ($cellProducts['total'] > 0) {
         $entity = EntityFactory::loadEntity('MeasureRates');
         foreach ($cellProducts['data'] as $product) {
             if ($product['remainder'] > 0) {
                 // Получаем кол-во поддонов на основании остатков. Остаток всегда в кг
                 $panNum = ceil($entity->getRatedValue(KG_MEASURE, P_MEASURE, $product['product_id'], $product['remainder']));
                 // Получаем текущую занимаемую площадь
                 $usedArea = ceil($entity->getRatedValue(P_MEASURE, M2_MEASURE, 0, $panNum));
                 $freeArea -= $usedArea;
             }
         }
     }
     return $freeArea;
 }
 public function getAllAvailable()
 {
     $select = $this->getTable() . '.*';
     $select .= ', products.title AS product_title';
     $select .= ', measures.title AS measure_title';
     $select .= ', factories.title AS factory_title';
     $select .= ', measures.short_title AS measure_short_title';
     $select .= ', users.fullname AS user';
     $select .= ', product_groups.title AS group_title';
     $select .= ', products.title AS product_title';
     $select .= ', factories_remainders.remainder AS remainder';
     $sql = 'SELECT ' . $select . ' FROM ' . $this->getTable();
     $sql .= ' INNER JOIN products ON (' . $this->getTable() . '.product_id = products.id)';
     $sql .= ' INNER JOIN measures ON (' . $this->getTable() . '.measure_id = measures.id)';
     $sql .= ' INNER JOIN factories ON (' . $this->getTable() . '.factory_id = factories.id)';
     $sql .= ' INNER JOIN users ON (' . $this->getTable() . '.user_id = users.id)';
     $sql .= ' INNER JOIN product_groups ON (products.group_id = product_groups.id)';
     $sql .= ' INNER JOIN factories_remainders ON (' . $this->getTable() . '.id = factories_remainders.product_factored_id)';
     $sql .= ' WHERE factories_remainders.remainder > 0';
     if ($filter = $this->getFilter()) {
         $sql .= ' AND ' . $filter;
     }
     $sql .= $this->getSort();
     $all = $this->getDb()->getAllAssoc($sql);
     if (!empty($all)) {
         $entity = EntityFactory::loadEntity('Remainders', 'factory');
         foreach ($all as $key => $product) {
             $all[$key]['date_formated'] = str_replace(' 00:00', '', $this->formatDate($all[$key]['factored_date']));
             $all[$key]['remainder'] = $entity->getCurrentRemainder($product['id'], $product['factory_id']);
         }
     }
     return array('data' => $all, 'total' => count($all));
 }
 public function moveToDcCells($request)
 {
     $data = array();
     foreach ($request['products'] as $moveProduct) {
         $errors = 0;
         $moveProduct['user_id'] = Auth::isLoggedIn();
         $entity = EntityFactory::loadEntity('ProductsFactored');
         $moveProduct['product_factored_id'] = $entity->getFactoredProduct($moveProduct['product_id'], $moveProduct['products_part']);
         // Пересчитываем кол-во в килограммы. Все остатки хранятся в кг.
         $entity = EntityFactory::loadEntity('MeasureRates');
         $quantityKg = $moveProduct['quantity'];
         if ($moveProduct['measure_id'] != KG_MEASURE) {
             if ($moveProduct['measure_id'] == GM_MEASURE || $moveProduct['measure_id'] == TN_MEASURE) {
                 $product = 0;
             } else {
                 $product = $moveProduct['product_id'];
             }
             $quantityKg = $entity->getRatedValue($moveProduct['measure_id'], KG_MEASURE, $product, $moveProduct['quantity']);
         }
         $entity = EntityFactory::loadEntity('Remainders', 'dc');
         $currentRemainder = $entity->getCurrentRemainder($moveProduct['product_factored_id'], $moveProduct['dc_id']);
         if ($currentRemainder < $quantityKg) {
             $errors++;
             $msg = 'Ошибка перемещения. Доступный остаток: ' . $currentRemainder . 'кг.';
         }
         if ($errors == 0) {
             $entity = EntityFactory::loadEntity('DcCells');
             $freeArea = $entity->getCellFreeArea($moveProduct['dc_cell_id']);
             // Получаем кол-во поддонов на основании остатков. Остаток всегда в кг
             $entity = EntityFactory::loadEntity('MeasureRates');
             $m2 = ceil($entity->getRatedValue(KG_MEASURE, P_MEASURE, $moveProduct['product_id'], $quantityKg));
             if ($freeArea < $m2) {
                 $errors++;
                 $msg = 'Ошибка перемещения. Недостаточно свободного места. (Свободно: ' . $freeArea . 'м²)';
             }
         }
         if ($errors == 0) {
             $entity = EntityFactory::loadEntity('Remainders', 'dc');
             $result = $entity->decreaseReminder($moveProduct);
             if (!$result) {
                 $errors++;
                 $msg = 'Ошибка перемещения.';
             } else {
                 $entity = EntityFactory::loadEntity('Remainders', 'dcCells');
                 $result = $entity->increaseReminder($moveProduct);
                 if (!$result) {
                     $errors++;
                     $msg = 'Ошибка перемещения.';
                 } else {
                     $msg = $moveProduct['quantity'] . ' ';
                     $msg .= $moveProduct['measure_short_title'] . ' ';
                     $msg .= $moveProduct['product_title'] . ' [' . $moveProduct['group_title'] . '] ';
                     $msg .= 'успешно перемещено в ';
                     $cellTitle = substr($moveProduct['dc_cell_title'], 0, strpos($moveProduct['dc_cell_title'], ' ('));
                     $msg .= $cellTitle . ' [' . $moveProduct['dc_store_title'] . '] ';
                 }
             }
         }
         if ($errors > 0) {
             $data['is_error'] = true;
         } else {
             $data['is_error'] = false;
         }
         $data['messages'][] = $msg;
     }
     return $data;
 }
Exemplo n.º 7
0
 /**
  * Get a specific entity.
  * @param Entity $instance
  * @return Entity
  */
 public function fetch(Entity $instance)
 {
     if (!$instance->isAllowedMethod(__FUNCTION__)) {
         throw new \DomainException(__FUNCTION__ . ' not allowed on this entity.');
     }
     $url = sprintf('%s/%s/%s/%s', $this->getApiUrl(), $this->getNetworkId(), $this->getEndpointName($instance), $instance->getId());
     $response = \Httpful\Request::get($url)->authenticateWith($this->getLogin(), $this->getPassword())->parseWith(function ($body) use($instance) {
         return EntityFactory::createFromArray($instance->getNonQualifiedClassName(), (array) json_decode($body, true));
     })->send();
     if ($response->hasErrors()) {
         $exception = json_decode($response->raw_body);
         throw new \UnexpectedValueException(sprintf("API response raised a '%s' exception with a message: '%s'. Status code %s", $exception->name, $exception->message, $response->code));
     }
     return $response->body;
 }
Exemplo n.º 8
0
                            case 'f':
                                $recRemindersType = 'factory';
                                $productTrack['factory_id'] = $productTrack['to_id'];
                                break;
                            case 'd':
                                $recRemindersType = 'dc';
                                $productTrack['dc_id'] = $productTrack['to_id'];
                                break;
                            case 'a':
                                $recRemindersType = 'affiliate';
                                $productTrack['aff_id'] = $productTrack['to_id'];
                                break;
                            default:
                                break;
                        }
                        $entity = EntityFactory::loadEntity('Remainders', $recRemindersType);
                        $entity->increaseReminder($productTrack);
                    }
                }
            }
        }
    } else {
        $errors++;
        $data['messages'][] = 'Записи не выбраны.';
    }
    if ($errors > 0) {
        $data['is_error'] = true;
    } else {
        $data['is_error'] = false;
    }
} else {
Exemplo n.º 9
0
 protected function updateRemainders($request, $operation)
 {
     if (is_numeric($request['quantity'])) {
         $request['remainder'] = $request['quantity'];
         $request['datetime_modified'] = strtotime('now');
         // Пересчитываем кол-во в килограммы. Все остатки хранятся в кг.
         if ($request['measure_id'] != KG_MEASURE) {
             if ($request['measure_id'] == GM_MEASURE || $request['measure_id'] == TN_MEASURE) {
                 $product = 0;
             } else {
                 $product = $request['product_id'];
             }
             $entity = EntityFactory::loadEntity('MeasureRates');
             $request['remainder'] = $entity->getRatedValue($request['measure_id'], KG_MEASURE, $product, $request['quantity']);
         }
         // Проверяем наличие текущего остатка
         $current = $this->getCurrentRemainder($request['product_factored_id'], $request[$this->_recipientsField]);
         if ($current === null) {
             // Нет записи в БД. Добавляем новый остаток.
             if ($this->add($request)) {
                 return true;
             }
         } else {
             // Обновляем текущий остаток. (Текущий остаток может быть >= 0)
             $action = $operation == 'add' ? '+' : '-';
             $sql = 'UPDATE ' . $this->getTable() . ' SET remainder=remainder' . $action . $request['remainder'];
             $sql .= ', datetime_modified=' . $request['datetime_modified'];
             $sql .= ' WHERE product_factored_id=' . intval($request['product_factored_id']);
             $sql .= ' AND ' . $this->_recipientsField . '=' . intval($request[$this->_recipientsField]);
             if ($this->getDb()->query($sql)) {
                 return true;
             }
         }
     }
 }
Exemplo n.º 10
0
 /**
  * @param mixed $data
  * @return Entity
  */
 public function create($data = NULL)
 {
     $entity = $this->entityFactory->create($this->name);
     return $data === NULL ? $entity : $entity->setData($data);
 }
Exemplo n.º 11
0
    echo "\t tablename: correspond au nom de la table \n";
    echo "\t classname: nom de la classe genere \n";
    echo "\t chemin: chemin complet du fichier exemple: C:\\wamp\\www\\myproject\\application\\models\\maclasse.class.php \n";
    echo "\n\t Attention: Adapter le fichier config/config.xml pour l'acces a la base de donnees \n";
} else {
    $nomtable = $argv[1];
    $nomclasse = $argv[2];
    $path = $argv[3];
    /*	echo "Nom du script $nomscript \n";
    	echo "Nom de la table $nomtable \n";
    	echo "Nom de la classe  $nomclasse \n";
    	echo "Chemin du fichier  $path \n";
    	*/
    //Initialisation de la connexion à la base de donn�es
    Database::InitDB("config/config.xml");
    $fabrique = new EntityFactory($nomtable, $nomclasse);
    $contenu = $fabrique->generateClasse();
    //print_r($contenu);
    if (isset($path)) {
        $f = $path;
    } else {
        $f = "classgenerate/{$nomclasse}.class.php";
    }
    $text = $contenu;
    $handle = fopen($f, "w");
    // regarde si le fichier est accessible en écriture
    if (is_writable($f)) {
        // Ecriture
        if (fwrite($handle, $text) === FALSE) {
            echo "Impossible d ecrire dans le fichier {$f}";
            exit;
Exemplo n.º 12
0
 public function getRatedValue($originM, $rateM, $product = 0, $value)
 {
     $sql = 'SELECT rate FROM ' . $this->getTable() . ' WHERE measure1_id=' . intval($originM) . ' AND measure2_id=' . intval($rateM);
     if ($product > 0) {
         $sql .= ' AND product_id=' . intval($product);
     }
     $rate = $this->getDb()->getOne($sql);
     if (!empty($rate)) {
         return round($value * $rate, EntityFactory::getSetting('decimal_digits_num'));
     } else {
         $sql = 'SELECT rate FROM ' . $this->getTable() . ' WHERE measure2_id=' . intval($originM) . ' AND measure1_id=' . intval($rateM);
         if ($product > 0) {
             $sql .= ' AND product_id=' . intval($product);
         }
         $rate = $this->getDb()->getOne($sql);
         if (!empty($rate)) {
             return round($value / $rate, EntityFactory::getSetting('decimal_digits_num'));
         }
     }
 }
Exemplo n.º 13
0
<?php

if (!defined('KERNEL_LOADED')) {
    die;
}
require_once ENTITIES_COMPONENTS_DIR . 'EntityFactory.php';
$entity = EntityFactory::loadEntity('Directions');
$cmd = !empty($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'getGrid';
switch ($cmd) {
    case 'getDirections_F':
        $start = 'f';
        break;
    case 'getDirections_D':
        $start = 'd';
        break;
    case 'getDirections_C':
        $start = 'c';
        break;
    case 'getDirections_A':
    default:
        $start = 'a';
        break;
}
$data = $entity->getAllFiltered($start);
echo json_encode($data);
Exemplo n.º 14
0
            $actionId = $row['Action_id'];
            $voterId = $row['Voter_id'];
            $effect = $row['effect'];
            $voterEffect = array("actionId" => $actionId, "voterId" => $voterId, "effect" => $effect);
            $ret[] = $voterEffect;
        }
        $statement->close();
        $db->close();
        return $ret;
    }
    function getJsonData()
    {
        $data = array();
        $data["ActionTypes"] = $this->getActionTypes();
        $data["Actions"] = $this->getActions();
        $data["TargetedActions"] = $this->getTargetedActions();
        $data["ForkedActions"] = $this->getForkedActions();
        $data["ActionTriggers"] = $this->getActionTriggers();
        $data["StartingActions"] = $this->getStartingActions();
        $data["Candidates"] = $this->getCandidates();
        $data["Demographics"] = $this->getDemographics();
        $data["Donors"] = $this->getDonor();
        $data["DonorEffects"] = $this->getDonorEffect();
        $data["States"] = $this->getState();
        $data["Voters"] = $this->getVoter();
        $data["VoterEffects"] = $this->getVoterEffect();
        sendResponse(200, json_encode($data));
    }
}
$factory = new EntityFactory();
$factory->getJsonData();
Exemplo n.º 15
0
if (($cmd == 'getAffStoreCells' || $cmd == 'getAvailableAffStoreCells') && !empty($_REQUEST['aff_store_id'])) {
    $data = $entity->getGroupedBy('aff_store_id', intval($_REQUEST['aff_store_id']));
} else {
    $data = EntityFactory::processRequest($cmd);
}
if ($cmd == 'getGrid' || $cmd == 'getAffStoreCells' || $cmd == 'getAvailableAffStoreCells') {
    if ($data['total'] > 0) {
        $entity = EntityFactory::loadEntity('MeasureRates');
        foreach ($data['data'] as $key => $cell) {
            $data['data'][$key]['free_area'] = $cell['area'];
            $entity = EntityFactory::loadEntity('Cells');
            $cellProducts = $entity->getCellProducts($cell['id']);
            if ($cellProducts['total'] > 0) {
                $entity = EntityFactory::loadEntity('MeasureRates');
                foreach ($cellProducts['data'] as $product) {
                    if ($product['remainder'] > EntityFactory::getSetting('min_reminder')) {
                        // Получаем кол-во поддонов на основании остатков. Остаток всегда в кг
                        $panNum = ceil($entity->getRatedValue(KG_MEASURE, P_MEASURE, $product['product_id'], $product['remainder']));
                        // Получаем текущую занимаемую площадь
                        $usedArea = ceil($entity->getRatedValue(P_MEASURE, M2_MEASURE, 0, $panNum));
                        $data['data'][$key]['free_area'] -= $usedArea;
                    }
                }
            }
        }
        // Убираем полностью занятые камеры из выпадающего списка.
        if ($cmd == 'getAvailableAffStoreCells') {
            $info = $data['data'];
            $data = array();
            foreach ($info as $key => $row) {
                if ($row['free_area'] > 0) {
<?php

if (!defined('KERNEL_LOADED')) {
    die;
}
require_once ENTITIES_COMPONENTS_DIR . 'EntityFactory.php';
$cmd = !empty($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'getGrid';
$possibleDirections = array('ff', 'fd', 'fa', 'fc');
$entity = EntityFactory::loadEntity('ProductsMovement', $possibleDirections);
if (!empty($_REQUEST['f']) && $cmd == 'ship') {
    foreach ($_REQUEST['f']['products'] as $key => $request) {
        $_REQUEST['f']['products'][$key]['factory_id'] = $_REQUEST['f']['factory_id'];
        $_REQUEST['f']['products'][$key]['factory_title'] = $_REQUEST['f']['factory_title'];
    }
    $data = $entity->shipProducts($_REQUEST['f']);
} else {
    $data = EntityFactory::processRequest($cmd);
    if ($cmd == 'getGrid') {
        foreach ($data['data'] as $key => $val) {
            if ($val['direction'] == 'fd' && empty($val['from_id'])) {
                unset($data['data'][$key]);
                $data['total']--;
            }
        }
    }
}
echo json_encode($data);
Exemplo n.º 17
0
 public static function loadEntity($entity, $type = '')
 {
     require_once ENTITIES_COMPONENTS_DIR . 'settings.entity.php';
     self::$sysEntity = new SettingsEntity();
     $dateFormat = self::getSetting('date_format');
     switch ($entity) {
         case 'Users':
             require_once ENTITIES_COMPONENTS_DIR . 'user.entity.php';
             self::$entity = new UserEntity();
             break;
         case 'UserGroups':
             require_once ENTITIES_COMPONENTS_DIR . 'userGroup.entity.php';
             self::$entity = new UserGroupEntity();
             break;
         case 'Cells':
             require_once ENTITIES_COMPONENTS_DIR . 'cell.entity.php';
             self::$entity = new CellEntity();
             break;
         case 'Stores':
             require_once ENTITIES_COMPONENTS_DIR . 'store.entity.php';
             self::$entity = new StoreEntity();
             break;
         case 'Products':
             require_once ENTITIES_COMPONENTS_DIR . 'product.entity.php';
             self::$entity = new ProductEntity();
             break;
         case 'ProductsFactored':
             require_once ENTITIES_COMPONENTS_DIR . 'productsFactored.entity.php';
             self::$entity = new ProductsFactoredEntity();
             break;
         case 'ProductsMovement':
             require_once ENTITIES_COMPONENTS_DIR . 'productsMovement.entity.php';
             self::$entity = new ProductsMovementEntity(null, $type);
             break;
         case 'Remainders':
             require_once ENTITIES_COMPONENTS_DIR . 'remainders.entity.php';
             self::$entity = new RemindersEntity(null, $type);
             break;
         case 'ProductGroups':
             require_once ENTITIES_COMPONENTS_DIR . 'productGroup.entity.php';
             self::$entity = new ProductGroupEntity();
             break;
         case 'Measures':
             require_once ENTITIES_COMPONENTS_DIR . 'measure.entity.php';
             self::$entity = new MeasureEntity();
             break;
         case 'MeasureRates':
             require_once ENTITIES_COMPONENTS_DIR . 'measureRate.entity.php';
             self::$entity = new MeasureRateEntity();
             break;
         case 'Cities':
             require_once ENTITIES_COMPONENTS_DIR . 'city.entity.php';
             self::$entity = new CityEntity();
             break;
         case 'Countries':
             require_once ENTITIES_COMPONENTS_DIR . 'country.entity.php';
             self::$entity = new CountryEntity();
             break;
         case 'Factories':
             require_once ENTITIES_COMPONENTS_DIR . 'factory.entity.php';
             self::$entity = new FactoryEntity();
             break;
         case 'DC':
             require_once ENTITIES_COMPONENTS_DIR . 'dc.entity.php';
             self::$entity = new DcEntity();
             break;
         case 'DcStores':
             require_once ENTITIES_COMPONENTS_DIR . 'dcStore.entity.php';
             self::$entity = new DcStoreEntity();
             break;
         case 'DcCells':
             require_once ENTITIES_COMPONENTS_DIR . 'dcCell.entity.php';
             self::$entity = new DcCellEntity();
             break;
         case 'Affiliates':
             require_once ENTITIES_COMPONENTS_DIR . 'affiliate.entity.php';
             self::$entity = new AffiliateEntity();
             break;
         case 'Clients':
             require_once ENTITIES_COMPONENTS_DIR . 'client.entity.php';
             self::$entity = new ClientEntity();
             break;
         case 'Directions':
             require_once ENTITIES_COMPONENTS_DIR . 'directions.entity.php';
             self::$entity = new DirectionsEntity();
             break;
         case 'Carriers':
             require_once ENTITIES_COMPONENTS_DIR . 'carrier.entity.php';
             self::$entity = new CarrierEntity();
             break;
         case 'CarriersVehicles':
             require_once ENTITIES_COMPONENTS_DIR . 'carrierVehicle.entity.php';
             self::$entity = new CarrierVehicleEntity();
             break;
         case 'CarriersDrivers':
             require_once ENTITIES_COMPONENTS_DIR . 'carrierDriver.entity.php';
             self::$entity = new CarrierDriverEntity();
             break;
         case 'Settings':
         default:
             self::$entity = self::$sysEntity;
             break;
     }
     self::$entity->setDateFormat($dateFormat);
     return self::$entity;
 }