• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP VF_Schema类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testShoulNotdHaveGlobal

 function testShoulNotdHaveGlobal()
 {
     $this->schemaGenerator()->dropExistingTables();
     $this->schemaGenerator()->execute(array('year','make','model'));
     $schema = new VF_Schema();
     $this->assertTrue($schema->hasGlobalLevel());
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:7,代码来源:GlobalTest.php


示例2: 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


示例3: vafDoLevel

function vafDoLevel( $level, $parent_id = 0 )
{    
    $schema = new VF_Schema();
    $finder = new VF_Level( $level );
    $parentLevel = $schema->getPrevLevel( $level );
    if( $parentLevel )
    {
        $entities = $finder->listInUse( array( $parentLevel => $parent_id ) );
    }
    else
    {
        $entities = $finder->listInUse();
    }
    echo $level . '["' . $parent_id . '"] = new Array();';
    foreach( $entities as $entity )
    {
        ?>
        var obj = new Array();
        obj["title"] = "<?=$entity->getTitle()?>";
        obj["id"] = "<?=$entity->getId()?>";
        <?=$level?>["<?=$parent_id?>"].push( obj );
        <?php
        if( $level != $schema->getLeafLevel() )
        {
            vafDoLevel( $schema->getNextLevel($level), $entity->getId() );
        }
        echo "\n";
    }
    
}
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:30,代码来源:loader_offline.js.php


示例4: getFitForSku

    /**
     * @deprecated
     */
    function getFitForSku($sku, $schema = null)
    {
        if (is_null($schema)) {
            $schema = new VF_Schema;
        }

        $sql = sprintf(
            "SELECT `entity_id` from `test_catalog_product_entity` WHERE `sku` = %s",
            $this->getReadAdapter()->quote($sku)
        );
        $r = $this->query($sql);
        $product_id = $r->fetchColumn();

        $r->closeCursor();

        $sql = sprintf(
            "SELECT `%s_id` from `elite_1_mapping` WHERE `entity_id` = %d AND `universal` = 0",
            $schema->getLeafLevel(),
            $product_id
        );
        $r = $this->query($sql);
        $leaf_id = $r->fetchColumn();
        $r->closeCursor();

        if (!$leaf_id) {
            return false;
        }
        $finder = new VF_Vehicle_Finder($schema);
        return $finder->findByLeaf($leaf_id);
    }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:33,代码来源:TestCase.php


示例5: 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


示例6: 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


示例7: 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


示例8: 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


示例9: getSchema

 function getSchema()
 {
     $schema = new VF_Schema();
     if (!is_null($this->getConfig())) {
         $schema->setConfig($this->getConfig());
     }
     return $schema;
 }
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:8,代码来源:Elite_Vafsitemap_Model_Url_Rewrite_Slug.php


示例10: getSchema

 function getSchema()
 {
     if (isset($this->schema)) {
         return $this->schema;
     }
     $schema = new VF_Schema();
     $schema->setConfig($this->getConfig());
     return $this->schema = $schema;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:9,代码来源:Abstract.php


示例11: 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


示例12: 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


示例13: 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


示例14: 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


示例15: 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


示例16: 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


示例17: 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


示例18: 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


示例19: 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


示例20: removeFitments

 function removeFitments($product)
 {
     $schema = new \VF_Schema();
     if (is_array($this->params()->fromPost('vaf-delete')) && count($this->params()->fromPost('vaf-delete')) >= 1) {
         foreach ($this->params()->fromPost('vaf-delete', array()) as $fit) {
             $fit = explode('-', $fit);
             $level = $fit[0];
             $fit = $fit[1];
             if ($level == $schema->getLeafLevel()) {
                 $product->deleteVafFit($fit);
             }
         }
     }
 }
开发者ID:vehiclefits,项目名称:admin,代码行数:14,代码来源:IndexController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP VF_Singleton类代码示例发布时间:2022-05-23
下一篇:
PHP VBX_User类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap