当前位置: 首页>>代码示例>>PHP>>正文


PHP VF_Schema::getLevels方法代码示例

本文整理汇总了PHP中VF_Schema::getLevels方法的典型用法代码示例。如果您正苦于以下问题:PHP VF_Schema::getLevels方法的具体用法?PHP VF_Schema::getLevels怎么用?PHP VF_Schema::getLevels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VF_Schema的用法示例。


在下文中一共展示了VF_Schema::getLevels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rowResult

    protected function rowResult()
    {
	$this->getReadAdapter()->getConnection()->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
	$select = $this->getReadAdapter()->select()
			->from($this->schema()->mappingsTable(), array('id', 'universal'));
	foreach ($this->schema->getLevels() as $level)
	{
	    $levelTable = $this->schema()->levelTable($level);
	    $condition = sprintf('%s.id = '.$this->schema()->mappingsTable().'.%s_id', $levelTable, $level);
	    $select->joinLeft($levelTable, $condition, array($level => 'title'));
	}
	$select->joinLeft(array('p' => $this->getProductTable()), 'p.entity_id = '.$this->schema()->mappingsTable().'.entity_id', array('sku'));
	return $this->query($select);
    }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:14,代码来源:Export.php

示例2: saveLeafLevels

 protected function saveLeafLevels()
 {
     $schema = new VF_Schema();
     
     $select = $this->getReadAdapter()->select()
         ->from( 'elite_' . $schema->getLeafLevel() );
     $result = $select->query();
     
     $vehicleFinder = new VF_Vehicle_Finder( $schema );
     while( $row = $result->fetchObject() )
     {
         $vehicle = $vehicleFinder->findByLeaf( $row->id );
         $bind = array();
         foreach( $schema->getLevels() as $level )
         {
             $bind[ $level . '_id' ] = $vehicle->getLevel( $level )->getId();
         }
         try
         {
             $this->getReadAdapter()->insert( 'elite_definition', $bind );
         }
         catch( Exception $e )
         {
         }
     }
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:26,代码来源:Upgrader.php

示例3: testShouldGetSchemaById

 function testShouldGetSchemaById()
 {
     $schema = VF_Schema::create('foo,bar');
     $schemaID = $schema->id();
     $new_schema = new VF_Schema($schemaID);
     $this->assertEquals(array('foo', 'bar'), $new_schema->getLevels(), 'should look up schema specified by ID passed to constructor');
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:7,代码来源:MultipleTest.php

示例4: execute

 function execute( VF_Schema $schema, $alphaNumeric=false )
 {
     $this->alphaNumeric = $alphaNumeric;
     $this->schema = $schema;
     
     $levels = $schema->getLevels();
     $c = count( $levels );
     
     $levelFinder = new VF_Level_Finder();
     if( isset( $_GET['front'] ) )
     {
         $product = isset($_GET['product']) ? $_GET['product'] : null;
         if($alphaNumeric)
         {
             $children = $levelFinder->listInUseByTitle( new VF_Level($this->requestLevel()), $this->requestLevels(), $product );
         }
         else
         {
             $children = $levelFinder->listInUse( new VF_Level($this->requestLevel()), $this->requestLevels(), $product );
         }
     }
     else
     {
         $children = $levelFinder->listAll( $this->requestLevel(), $this->requestLevels() );
     }
     
     echo $this->renderChildren($children);
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:28,代码来源:VF_Ajax.php

示例5: run

 function run()
 {
     $schema = new VF_Schema();
     $db = Elite_Vaf_Helper_Data::getInstance()->getReadAdapter();
     foreach ($schema->getLevels() as $level) {
         $db->query('ALTER TABLE `elite_level_' . str_replace(' ', '_', $level) . '` ADD INDEX ( `title` )   ');
     }
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:8,代码来源:Elite_Vaf_sql_migrations_23_add_title_index.php

示例6: run

 function run()
 {
     $schema = new VF_Schema();
     $db = Elite_Vaf_Helper_Data::getInstance()->getReadAdapter();
     foreach ($schema->getLevels() as $level) {
         $db->query('ALTER TABLE `elite_mapping` ADD INDEX ( `entity_id` ) ;');
     }
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:8,代码来源:Elite_Vaf_sql_migrations_25_add_mapping_index.php

示例7: run

 function run()
 {
     $schema = new VF_Schema();
     $db = VF_Singleton::getInstance()->getReadAdapter();
     foreach ($schema->getLevels() as $level) {
         $db->query('ALTER TABLE `elite_product_wheel` ADD `offset` FLOAT NOT NULL ');
         $db->query('ALTER TABLE `elite_definition_wheel` ADD `offset` FLOAT NOT NULL ');
     }
 }
开发者ID:ngagestudios,项目名称:Vehicle-Fits-Magento,代码行数:9,代码来源:24_add_offset.php

示例8: testShouldAddSecondSchema

 function testShouldAddSecondSchema()
 {
     $command = __DIR__ . '/vf schema --force --levels="year,make,model"';
     exec($command);
     $command = __DIR__ . '/vf schema --add --levels="foo,bar"';
     exec($command);
     $schema = new VF_Schema(2);
     $this->assertEquals(array('foo', 'bar'), $schema->getLevels(), 'should create second schema');
 }
开发者ID:vehiclefits,项目名称:library,代码行数:9,代码来源:schemaTest.php

示例9: setSortingLevels

 function setSortingLevels()
 {
     $schema = new VF_Schema();
     foreach ($schema->getLevels() as $level) {
         if (isset($_GET[$level . 'Sorting'])) {
             $this->generator()->setSorting($level, $_GET[$level . 'Sorting']);
         }
     }
 }
开发者ID:ngagestudios,项目名称:Vehicle-Fits-Magento,代码行数:9,代码来源:SchemaController.php

示例10: run

 function run()
 {
     $schema = new VF_Schema();
     $db = Elite_Vaf_Helper_Data::getInstance()->getReadAdapter();
     foreach ($schema->getLevels() as $level) {
         $old = 'elite_' . $level;
         $new = 'elite_level_' . $level;
         $db->query(sprintf("RENAME TABLE %s TO %s", $old, $new));
     }
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:10,代码来源:Elite_Vaf_sql_migrations_16_namespace_level_tbls.php

示例11: testShouldSetSchema

 function testShouldSetSchema()
 {
     $schemaGenerator = new VF_Schema_Generator();
     $schemaGenerator->dropExistingTables();
     VF_Schema::$levels = null;
     $command = __DIR__ . '/vfmagento schema --force --levels="year,make,model"';
     exec($command);
     $schema = new VF_Schema();
     $this->assertEquals(array('year', 'make', 'model'), $schema->getLevels(), 'should create default schema of MMY');
 }
开发者ID:ngagestudios,项目名称:Vehicle-Fits-Magento,代码行数:10,代码来源:vfmagentoTest.php

示例12: testOneQueryAcrossInstances

 function testOneQueryAcrossInstances()
 {
     $this->getReadAdapter()->getProfiler()->clear();
     $this->getReadAdapter()->getProfiler()->setEnabled(true);
     $schema = new VF_Schema();
     $schema->getLevels();
     $schema = new VF_Schema();
     $schema->getLevels();
     $queries = $this->getReadAdapter()->getProfiler()->getQueryProfiles();
     $this->assertEquals(1, count($queries));
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:11,代码来源:PerformanceTest.php

示例13: addUniqueOnDefinitions

 function addUniqueOnDefinitions()
 {
     $schema = new VF_Schema();
     $db = Elite_Vaf_Helper_Data::getInstance()->getReadAdapter();
     $levels = array();
     foreach ($schema->getLevels() as $level) {
         $levels[] = sprintf('`%s_id`', $level);
     }
     $levels = implode(',', $levels);
     $query = "ALTER TABLE `elite_definition` ADD UNIQUE ( %s );";
     $db->query(sprintf($query, $levels));
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:12,代码来源:Elite_Vaf_sql_migrations_2_add_unique_on_definitions_tbl.php

示例14: levels

 function levels()
 {
     $params = $this->getRequest()->getParam('vehicle');
     $params = explode("-", $params);
     $schema = new VF_Schema();
     $levels = array();
     foreach ($schema->getLevels() as $level) {
         $levels[$level] = current($params);
         next($params);
     }
     return $levels;
 }
开发者ID:ngagestudios,项目名称:Vehicle-Fits-Magento,代码行数:12,代码来源:RemoveController.php

示例15: save

    function save()
    {
        if (!(int) $this->product_id)
        {
            throw new Exception('Trying to insert a mapping with no product ID');
        }
        $schema = new VF_Schema;
        $schema->setConfig($this->getConfig());
        $levels = $schema->getLevels();

        $select = $this->getReadAdapter()->select()
                        ->from($schema->mappingsTable(), array('id'));
        foreach ($this->vehicle->toValueArray() as $level => $id)
        {
            $select->where($this->inflect($level) . '_id = ?', $id);
        }
        $select->where('entity_id = ?', $this->product_id);

        $id = (int) $select->query()->fetchColumn();
        if (0 !== $id)
        {
            return $id;
        }

        $columns = '';
        $values = '';
        foreach ($levels as $level)
        {
            $columns .= '`' . $this->inflect($level) . '_id`,';
            $values .= $this->inflect($this->vehicle->getLevel($level)->getId());
            $values .= ',';
        }
        $query = sprintf(
                        '
            INSERT INTO
                `'.$schema->mappingsTable().'`
            (
                ' . $columns . '
                `entity_id`
            )
            VALUES
            (
                ' . $values . '
                %d
            )
            ',
            (int) $this->product_id
        );
        $r = $this->query($query);
        return $this->getReadAdapter()->lastInsertId();
    }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:51,代码来源:Mapping.php


注:本文中的VF_Schema::getLevels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。