Exemplo n.º 1
2
 public function load(ObjectManager $manager)
 {
     $user = $manager->getRepository('TaichiUserBundle:User')->findOneBy(['username' => 'heaven']);
     foreach (range(1, self::POST_NUMS) as $i) {
         $post = new Post();
         $categories = $manager->getRepository('TaichiBlogBundle:Category')->findAll();
         $categoryIds = [];
         foreach ($categories as $category) {
             $categoryIds[] = $category->getId();
         }
         $cIdKey = array_rand($categoryIds, 1);
         $category = $manager->getRepository('TaichiBlogBundle:Category')->find($categoryIds[$cIdKey]);
         $post->setSubject(implode(' ', array_map('ucfirst', $this->faker->words(mt_rand(3, 5)))));
         $post->setAbstract($this->faker->paragraph(mt_rand(2, 4)));
         $post->setContent($this->faker->paragraph(mt_rand(6, 10)));
         $post->setUser($user);
         $post->setCategory($category);
         //Add tags
         $tags = $manager->getRepository('TaichiBlogBundle:Tag')->findAll();
         $tagIds = [];
         foreach ($tags as $tag) {
             $tagIds[] = $tag->getId();
         }
         $tIdKeys = array_rand($tagIds, mt_rand(2, 5));
         foreach ($tIdKeys as $tIdKey) {
             $tag = $manager->getRepository('TaichiBlogBundle:Tag')->find($tagIds[$tIdKey]);
             $post->addTag($tag);
         }
         $post->setPictureUrl($this->faker->imageUrl(400, 240));
         $post->setCreatedAt($this->faker->dateTimeBetween('-1 year', '-10 days'));
         $post->setUpdatedAt($post->getCreatedAt());
         foreach (range(1, mt_rand(1, self::COMMENT_NUMS)) as $j) {
             $comment = new Comment();
             $comment->setUser($user);
             $comment->setCreatedAt($this->faker->dateTimeBetween($post->getCreatedAt(), 'now'));
             $comment->setUpdatedAt($comment->getCreatedAt());
             $comment->setContent($this->faker->paragraph(mt_rand(1, 3)));
             $comment->setPost($post);
             $manager->persist($comment);
             $post->addComment($comment);
         }
         $manager->persist($post);
     }
     $manager->flush();
 }
 public function getDummyData(Generator $faker)
 {
     return ['user_id' => $this->getRandom('User')->id, 'mail_id' => $this->getRandom('Mail')->id, 'action' => $faker->randomElement(['create', 'refer', 'comment', 'delete', 'block', 'close']), 'comment' => $faker->paragraph(1), 'refer_user_id' => $this->getRandom('User')->id];
 }
 /**
  * Gets a random set of paragraphs
  *
  * @param Faker\Generator
  * @return string
  */
 public function getFakeData(Generator $faker)
 {
     $paragraphs = rand(1, 5);
     $i = 0;
     $ret = "";
     while ($i < $paragraphs) {
         $ret .= "<p>" . $faker->paragraph(rand(2, 6)) . "</p>";
         $i++;
     }
     return $ret;
 }
Exemplo n.º 4
0
 public function getDummyData(Generator $faker, array $custom = [])
 {
     return ['biography' => $faker->paragraph(4), 'twitter' => '@' . $faker->userName, 'path_avatar' => $faker->imageUrl(250, 300, 'people'), 'web' => $faker->domainName, 'user_id' => $faker->unique()->numberBetween(1, 300)];
 }
 public function getDummyData(Generator $faker, array $customValues = [])
 {
     return ['reference' => $faker->unique()->bothify('????###'), 'description' => $faker->paragraph(1), 'strip_type_id' => rand(1, 5)];
 }
 /**
  * Gets a random paragraph
  *
  * @param Faker\Generator
  * @return string
  */
 public function getFakeData(Generator $faker)
 {
     return $faker->paragraph(rand(1, 3));
 }
 public function getDummyData(Generator $faker, array $customValues = [])
 {
     return ['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->email, 'type' => $faker->randomElement(['general', 'private', 'contact', 'contact']), 'content' => $faker->paragraph(6)];
 }
Exemplo n.º 8
0
 public function getDummyData(Generator $faker)
 {
     return ['status' => $faker->randomElement(['open', 'delete', 'block', 'close']), 'ore_id' => $faker->numberBetween(0, 500), 'date_in' => $faker->date('Y-m-d', 'now'), 'type' => $faker->randomElement(['letter', 'suitcase', 'other']), 'sender_ref' => $faker->phoneNumber, 'sender_id' => rand(1, 10), 'sender_details' => $faker->company, 'issue' => $faker->paragraph(2), 'user_id' => $this->getRandom('User')->id, 'dependence_id' => rand(1, 16)];
 }
Exemplo n.º 9
0
 public function getDummyData(\Faker\Generator $faker, array $customValues = array())
 {
     return ['name' => $faker->sentence(2), 'type' => $faker->randomElement(['DIG', 'DIG', 'CRE']), 'description' => $faker->paragraph(3), 'objectives' => $faker->paragraph(6), 'status' => $faker->randomElement([false, false, true]), 'customer_id' => $this->getRandom('Customer')->id];
 }
 public function getDummyData(Generator $faker, array $valoresPersonalizados = array())
 {
     return ['user_id' => $this->getRandom('User')->id, 'ticket_id' => $this->getRandom('Ticket')->id, 'comentario' => $faker->paragraph(), 'link' => $faker->randomElement(['', '', $faker->url])];
 }
 public function getDummyData(Generator $faker, array $customValues = [])
 {
     return ['reference' => $faker->randomNumber(4), 'name' => $faker->sentence(2), 'description' => $faker->paragraph(1)];
 }
 public function getDummyData(Generator $faker)
 {
     return ["website" => $faker->url(), "comment" => $faker->paragraph(), "user_id" => $this->getRandomId("User"), "ticket_id" => $this->getRandomId("Ticket")];
 }
Exemplo n.º 13
0
 public function getDummyData(\Faker\Generator $faker, array $customValues = array())
 {
     return ['user_id' => $this->random('User')->id, 'ticket_id' => $this->random('Ticket')->id, 'comment' => $faker->paragraph(), 'link' => $faker->randomElement(['', '', $faker->url])];
 }
Exemplo n.º 14
0
 /**
  * @param Generator $oFaker
  * @return array
  */
 function __invoke(Generator $oFaker)
 {
     return [Key::COLUMN_NAME => "key." . $oFaker->word, Key::COLUMN_DESCRIPTION => "key." . $oFaker->paragraph()];
 }
Exemplo n.º 15
0
 /**
  * Create a new (fake) product
  * 
  * @return Product
  */
 protected function create()
 {
     return new Product($this->faker->sentence(3), $this->faker->imageUrl(), $this->faker->paragraph(3));
 }
Exemplo n.º 16
-1
 /**
  * Generate a comment
  *
  * @param   int     $minParagraphs  Minimum number of paragraphs
  * @param   int     $maxParagraphs  Maximum number of paragraphs
  * @param   int     $images         Number of images to include in the comment
  * @param   int     $minSentences   Minimum number of sentences per paragraph
  * @param   int     $maxSentences   Maximum number of sentences per paragraph
  * @return  string
  */
 public function comment($minParagraphs = 1, $maxParagraphs = 4, $images = 0, $minSentences = 3, $maxSentences = 9)
 {
     /* Generate ipsum text */
     $count = mt_rand($minParagraphs, $maxParagraphs);
     $ipsumArray = array();
     for ($c = 0; $c < $count; $c++) {
         $ipsumArray[] = $this->faker->paragraph(mt_rand($minSentences, $maxSentences));
     }
     /* Add in images at random */
     for ($c = 0; $c < $images; $c++) {
         $image = "<img src='{$this->faker->imageUrl()}' alt='faker_image' class='ipsImage'>";
         array_splice($ipsumArray, mt_rand(0, count($ipsumArray)), $image);
     }
     /* Generate HTML output from our array */
     $ipsumText = '';
     foreach ($ipsumArray as $line) {
         $ipsumText = $ipsumText . "<p>{$line}</p>";
     }
     return $ipsumText;
 }
 public function getDummyData(Generator $faker, array $customValues = [])
 {
     return ['reference' => $faker->unique()->bothify('????###'), 'description' => $faker->paragraph(1), 'street' => $faker->streetName, 'croos' => $faker->streetName, 'latitude' => $faker->latitude(), 'longitude' => $faker->longitude(), 'capacity' => rand(1, 600)];
 }