Skip to content

Instantly share code, notes, and snippets.

View Etheriq's full-sized avatar

Yuriy Tarnavskiy Etheriq

  • eKreative
  • Ukraine
View GitHub Profile
@Etheriq
Etheriq / users.yml
Created October 21, 2015 12:29
example user generation with true password
AppBundle\Entity\User:
user{1..30}:
name: <name()>
email: <email()>
password: <encodePassword(@self, "123")>
address: <address()>
lat: <latitude()>
lng: <longitude()>
phone: <phoneNumber()>
zip: <postcode()>
@Etheriq
Etheriq / FixturesLoader.php
Last active October 21, 2015 12:25
example custom password generation
<?php
public function encodePassword(User $user, $plainPassword)
{
/** @var \Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface $encoder */
$encoder = $this->container->get('security.encoder_factory')
->getEncoder($user);
return $encoder->encodePassword($plainPassword, $user->getSalt());
}
@Etheriq
Etheriq / categories.yml
Created October 21, 2015 11:49
example for categories
AppBundle\Entity\Category:
category{1..150}:
__construct: false
title: <word()>
@Etheriq
Etheriq / tags.yml
Created October 21, 2015 11:47
example for tags
AppBundle\Entity\Tag:
tag{1..80}:
__construct: [<text(10)>]
title: <word()>
@Etheriq
Etheriq / users.yml
Created October 21, 2015 11:43
example for generating users and products
AppBundle\Entity\User:
user{1..30}:
name: <name()>
email: <email()>
password: <sha1()>
address: <address()>
lat: <latitude()>
lng: <longitude()>
phone: <phoneNumber()>
zip: <postcode()>
@Etheriq
Etheriq / config_test.yml
Created October 21, 2015 11:14
example config_test.yml for using alternative db
doctrine:
dbal:
default_connection: default
connections:
default:
driver: pdo_sqlite
memory: true
charset: UTF8
mapping_types:
enum: string
@Etheriq
Etheriq / FixturesLoader.php
Created October 21, 2015 10:55
Example fixtures loader class
<?php
namespace AppBundle\DataFixtures\ORM;
use Hautelook\AliceBundle\Alice\DataFixtureLoader;
class FixturesLoader extends DataFixtureLoader
{
/**
* Returns an array of file paths to fixtures