예제 #1
0
파일: Model.php 프로젝트: rostmefpoter/bh
 public function boot()
 {
     if (!$this->_boot) {
         $this->_boot = \Platform\Bootstrap::getInstance();
     }
     return $this->_boot;
 }
예제 #2
0
 /**
  * @return Bootstrap
  */
 public function boot()
 {
     return \Platform\Bootstrap::getInstance();
 }
예제 #3
0
파일: console.php 프로젝트: rostmefpoter/bh
<?php

date_default_timezone_set("Europe/Kiev");
setlocale(LC_ALL, 'ru_RU.UTF-8');
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
use Zend\ServiceManager\Config;
define('APP_NAME', 'buh');
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/src'), get_include_path())));
$loader = (require_once APPLICATION_PATH . '/../vendor/autoload.php');
//$loader->setUseIncludePath(true);
$boot = \Platform\Bootstrap::getInstance(new Config(include APPLICATION_PATH . '/config/' . APP_NAME . '/config.php'));
//foreach($boot->get('productCategory')->select() as $item) {
//	print_r($item);
//}
$tree = [];
$lines = explode("\n", file_get_contents('xxx.csv'));
foreach ($lines as $line) {
    list($cat, $scat, $prod) = explode(";", $line);
    if (!isset($tree[$cat])) {
        $tree[$cat] = [];
    }
    if (!isset($tree[$cat][$scat])) {
        $tree[$cat][$scat] = [];
    }
    $tree[$cat][$scat][] = $prod;
}
foreach ($tree as $c => $info1) {
    $cid = $boot->get('productCategory')->insert(['name' => $c]);
    echo $cid;
    foreach ($info1 as $sc => $info2) {
        $scid = $boot->get('productCategory')->insert(['name' => $sc, 'parent_id' => $cid]);