예제 #1
0
파일: faker.php 프로젝트: hadesain/thelia
}
// locales
if (isset($options['l'])) {
    $localeList = explode(',', str_replace(' ', '', $options['l']));
}
if (isset($options['c'])) {
    if (0 !== intval($options['c'])) {
        $numberCategories = intval($options['c']);
    }
}
if (isset($options['p'])) {
    if (0 !== intval($options['p'])) {
        $numberProducts = intval($options['p']);
    }
}
$thelia = new Thelia\Core\Thelia("dev", false);
$thelia->boot();
$thelia->getContainer()->get('thelia.translator');
// The default faker is en_US
$faker = Faker\Factory::create('en_US');
// Create localized version for content generation
$localizedFaker = [];
foreach ($localeList as $locale) {
    $localizedFaker[$locale] = Faker\Factory::create($locale);
}
$con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
$con->beginTransaction();
// Intialize URL management
$url = new Thelia\Tools\URL();
$currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne();
//\Thelia\Log\Tlog::getInstance()->setLevel(\Thelia\Log\Tlog::ERROR);
예제 #2
0
파일: import.php 프로젝트: margery/thelia
    }
}
if (!$bootstraped) {
    if (isset($bootstrapFile)) {
        require $bootstrapFile;
    } elseif (is_file($file = __DIR__ . '/../core/vendor/autoload.php')) {
        require $file;
    } elseif (is_file($file = __DIR__ . '/../../bootstrap.php')) {
        // Here we are on a thelia/thelia-project
        require $file;
    } else {
        echo "No autoload file found. Please use the -b argument to include yours";
        exit(1);
    }
}
$thelia = new Thelia\Core\Thelia("dev", true);
$thelia->boot();
// Load the translator
$thelia->getContainer()->get("thelia.translator");
$faker = Faker\Factory::create();
// Intialize URL management
$url = new Thelia\Tools\URL();
$con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
$con->beginTransaction();
try {
    $stmt = $con->prepare("SET foreign_key_checks = 0");
    $stmt->execute();
    clearTables($con);
    $stmt = $con->prepare("SET foreign_key_checks = 1");
    $stmt->execute();
    $material = createMaterials($con);
예제 #3
0
파일: import.php 프로젝트: alex63530/thelia
/*      This program is distributed in the hope that it will be useful,              */
/*      but WITHOUT ANY WARRANTY; without even the implied warranty of               */
/*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                */
/*      GNU General Public License for more details.                                 */
/*                                                                                   */
/*      You should have received a copy of the GNU General Public License            */
/*	    along with this program. If not, see <http://www.gnu.org/licenses/>.         */
/*                                                                                   */
/*************************************************************************************/
use Thelia\Model\ContentFolderQuery;
use Thelia\Model\ProductAssociatedContent;
if (php_sapi_name() != 'cli') {
    throw new \Exception('this script can only be launched with cli sapi');
}
require __DIR__ . '/../core/bootstrap.php';
$thelia = new Thelia\Core\Thelia("dev", true);
$thelia->boot();
$faker = Faker\Factory::create();
// Intialize URL management
$url = new Thelia\Tools\URL();
$con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
$con->beginTransaction();
try {
    $stmt = $con->prepare("SET foreign_key_checks = 0");
    $stmt->execute();
    clearTables($con);
    $stmt = $con->prepare("SET foreign_key_checks = 1");
    $stmt->execute();
    $material = createMaterials($con);
    $color = createColors($con);
    $brands = createBrands($faker, $con);
예제 #4
0
파일: faker.php 프로젝트: alex63530/thelia
use Thelia\Condition\ConditionFactory;
use Thelia\Condition\Implementation\MatchForEveryone;
use Thelia\Condition\Implementation\MatchForTotalAmount;
use Thelia\Condition\Implementation\MatchForXArticles;
use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface;
use Thelia\Condition\ConditionCollection;
use Thelia\Coupon\Type\RemoveXAmount;
use Thelia\Coupon\Type\RemoveXPercent;
use Thelia\Model\ModuleQuery;
use Thelia\Model\OrderAddress;
if (php_sapi_name() != 'cli') {
    throw new \Exception('this script can only be launched with cli sapi');
}
require __DIR__ . '/../core/bootstrap.php';
$thelia = new Thelia\Core\Thelia("dev", false);
$thelia->boot();
// The default faker is en_US
$faker = Faker\Factory::create('en_US');
// Create localized version for content generation
$localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT');
$localizedFaker = [];
foreach ($localeList as $locale) {
    $localizedFaker[$locale] = Faker\Factory::create($locale);
}
$con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
$con->beginTransaction();
// Intialize URL management
$url = new Thelia\Tools\URL();
$currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne();
//\Thelia\Log\Tlog::getInstance()->setLevel(\Thelia\Log\Tlog::ERROR);