Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZF2][Symfony] - nelmio/alice i fzaninotto/Faker, generowanie danych
damianooo
post
Post #1





Grupa: Zarejestrowani
Postów: 496
Pomógł: 2
Dołączył: 15.07.2011
Skąd: Katowice

Ostrzeżenie: (0%)
-----


Potrzebuję za pomocą pakietu nelmio/alice załadować do bazy danych listę danych w takiej kolejności:

  1. 1,2,3,4,3,4,3,5,6,5,6,5,4,3,4,5


mój YAML wygląda tak:

  1. My\CostamBundle\Entity\User:
  2. user{Damian,Wojtek,Mateusz,Marcin,Krystian,Piotrek1,Tomek,Michał,Adam1,Przemek1,Łukasz,Piotrek2,Kuba,Przemek2,Adam2,Piotrek3}:
  3. username: <current()>
  4. password: <current()>
  5. email: <current()>@test.pl
  6. digit: <sentences(1,2,3,4,3,4,3,5,6,5,6,5,4,3,4,5)>
  7. priority: 1


niestety nie znalazłem w opisie bundla odpowiedniej funkcji, która może to zrobić.

Próbowałem więc na różne sposóby:

  1. 1) digit: [1,2,3,4,3,4,3,5,6,5,6,5,4,3,4,5] - wywala błąd
  2. 2) digit: (1,2,3,4,3,4,3,5,6,5,6,5,4,3,4,5) - ładuje same zera
  3. 3) digit: ({1,2,3,4,3,4,3,5,6,5,6,5,4,3,4,5}) - ładuje same zera
  4. 4) digit: {1,2,3,4,3,4,3,5,6,5,6,5,4,3,4,5} - wywala błąd
  5. 5) digit: array(1,2,3,4,3,4,3,5,6,5,6,5,4,3,4,5) - ładuje same zera
  6. 6) digit: <array(1,2,3,4,3,4,3,5,6,5,6,5,4,3,4,5)> - wywala błąd
  7. 7) digit: <sentences(1,2,3,4,3,4,3,5,6,5,6,5,4,3,4,5)> - ładuje same zera


Próbowałem zastosować też bundla fzaninotto/Faker ale nie ma tam takiej funkcji jakiej potrzebuję:

  1. randomDigit // 7
  2. randomDigitNotNull // 5
  3. randomNumber($nbDigits = NULL) // 79907610
  4. randomFloat($nbMaxDecimals = NULL, $min = 0, $max = NULL) // 48.8932
  5. numberBetween($min = 1000, $max = 9000) // 8567
  6. randomLetter // 'b'
  7. randomElements($array = array ('a','b','c'), $count = 1) // array('c')
  8. randomElement($array = array ('a','b','c')) // 'b'
  9. shuffle('hello, world') // 'rlo,h eoldlw'
  10. shuffle(array(1, 2, 3)) // array(2, 1, 3)
  11. numerify('Hello ###') // 'Hello 609'
  12. lexify('Hello (IMG:style_emoticons/default/questionmark.gif) ?') // 'Hello wgt'
  13. bothify('Hello ##(IMG:style_emoticons/default/questionmark.gif) ') // 'Hello 42jz'
  14. asciify('Hello ***') // 'Hello R6+'
  15. regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // sm0@y8k96a.ej


Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kpt_lucek
post
Post #2





Grupa: Zarejestrowani
Postów: 428
Pomógł: 77
Dołączył: 10.07.2011
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


https://github.com/h4cc/AliceFixturesBundle...iders-for-faker
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 22:55