Beispiel #1
0
 /**
  * doExecute
  *
  * @return  void
  */
 public function doExecute()
 {
     $faker = \Faker\Factory::create();
     // This is example seeder, you can delete it.
     $mapper = new \Windwalker\DataMapper\DataMapper('main_cover');
     foreach (range(1, 50) as $i) {
         $data = new \Windwalker\Data\Data();
         $data->title = $faker->sentence(2);
         $data->text = $faker->paragraph(3);
         $data->state = $faker->randomElement(array(0, 1, 1));
         $mapper->createOne($data);
         $this->outCounting();
     }
 }
Beispiel #2
0
<?php

include_once __DIR__ . '/init.php';
$dm = new \Windwalker\DataMapper\DataMapper('#__datamapper');
$dataset = new \Windwalker\Data\DataSet();
foreach (range(1, 5) as $row) {
    $dataset[] = new \Windwalker\Data\Data(['title' => uniqid(), 'year' => rand(20, 100), 'text' => str_repeat(md5(uniqid()), rand(1, 20)), 'foo' => 123123]);
}
$result = $dm->create($dataset);
print_r($result);
Beispiel #3
0
<?php

/**
 * Part of Windwalker project. 
 *
 * @copyright  Copyright (C) 2011 - 2014 SMS Taiwan, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */
include_once __DIR__ . '/init.php';
$dm = new \Windwalker\DataMapper\DataMapper('#__flower_sakuras');
$result = $dm->findOne(null, 'title desc');
print_r($result);
Beispiel #4
0
<?php

include_once __DIR__ . '/init.php';
$dm = new \Windwalker\DataMapper\DataMapper('#__datamapper');
$dataset = new \Windwalker\Data\DataSet();
$dataset[] = new \Windwalker\Data\Data(['id' => 1, 'title' => uniqid(), 'year' => rand(20, 100), 'text' => str_repeat(md5(uniqid()), rand(1, 20))]);
$dataset[] = new \Windwalker\Data\Data(['id' => 2, 'title' => uniqid(), 'year' => rand(20, 100), 'text' => str_repeat(md5(uniqid()), rand(1, 20))]);
$dataset[] = new \Windwalker\Data\Data(['id' => 3, 'title' => uniqid(), 'year' => rand(20, 100), 'text' => str_repeat(md5(uniqid()), rand(1, 20))]);
$result = $dm->update($dataset);
print_r($result);