本文整理汇总了PHP中VF_Schema类的典型用法代码示例。如果您正苦于以下问题:PHP VF_Schema类的具体用法?PHP VF_Schema怎么用?PHP VF_Schema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VF_Schema类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testShoulNotdHaveGlobal
function testShoulNotdHaveGlobal()
{
$this->schemaGenerator()->dropExistingTables();
$this->schemaGenerator()->execute(array('year','make','model'));
$schema = new VF_Schema();
$this->assertTrue($schema->hasGlobalLevel());
}
示例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);
}
示例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";
}
}
示例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);
}
示例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');
}
示例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 )
{
}
}
}
示例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;
}
示例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');
}
示例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 ');
}
}
示例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']);
}
}
}
示例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');
}