Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [SF2][SF]Moduły: Tree,Translatable, Sluggable, Timestable, Loggable, Instalacja
basso
post 22.01.2013, 22:48:28
Post #1





Grupa: Zarejestrowani
Postów: 155
Pomógł: 1
Dołączył: 12.12.2010

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


Witam,
Zabrałem się za używanie: Tree,Translatable, Sluggable, Timestable, Loggable .
Z tego co wyczytałem, to do tego potrzeba jest zainstalowania Stof DoctrineExtensionsBundle.
Próbowałem zainstalować stąd: https://github.com/stof/StofDoctrineExtensi...s/doc/index.rst , ale nie bardzo mi to wychodzi.

Nie wiem czy dobrym torem idę. Wszystko robię na Symfony 2.1.

Stanąłem na i sypie błędami jak dopisuje to do configa "Add the extensions to your mapping" :
# app/config/config.yml
doctrine:
orm: ......

Podłączał ktoś z Was to?
Go to the top of the page
+Quote Post
pedro84
post 22.01.2013, 22:57:59
Post #2





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

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


Jakimi błędami?


--------------------
Google knows the answer...
Go to the top of the page
+Quote Post
basso
post 26.01.2013, 12:18:44
Post #3





Grupa: Zarejestrowani
Postów: 155
Pomógł: 1
Dołączył: 12.12.2010

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


Hej... system stawiałem i z deka mi zeszło, więc tak z opóźnieniem smile.gif

Nie wiem, czy ta wersja z której próbowałem instalować, jest do 2.1. Patrząc iż jest to wpisane w composer.json to rozumiem, że nie jest to 2.0 smile.gif

Wiec tak.
1. Zaciągnęło mi dobrze całego bundla po zainstalowaniu
2. Kolejny krok to zgodnie z instrukcją: Register the DoctrineExtensions and Stof namespaces

gdy wklejam to:
  1. // app/autoload.php
  2. $loader->registerNamespaces(array(
  3. 'Stof' => __DIR__.'/../vendor/bundles',
  4. 'Gedmo' => __DIR__.'/../vendor/gedmo-doctrine-extensions/lib',
  5. // your other namespaces
  6. ));


To mi wyskakuje:
Fatal error: Call to undefined method Composer\Autoload\ClassLoader::registerNamespaces() in C:\wamp\www\sym2\app\autoload.php on line 14

Moja struktura app/autoload.php wygląda tak: (tutaj wersja bez wklejonego powyższego kodu).

  1. <?php
  2.  
  3. use Doctrine\Common\Annotations\AnnotationRegistry;
  4.  
  5. $loader = require __DIR__.'/../vendor/autoload.php';
  6.  
  7. // intl
  8. if (!function_exists('intl_get_error_code')) {
  9. require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
  10.  
  11. $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
  12. }
  13.  
  14. AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
  15.  
  16. return $loader;



Kolejnych kroków nie mogę wykonać...no bo najpierw muszę to do autoloadera załadować ale jak widać jest jakiś problem ;/
Go to the top of the page
+Quote Post
pedro84
post 26.01.2013, 13:03:07
Post #4





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

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


Nie czytasz dokumentacji dobrze, mieszasz instalację za pomocą composera i bez:
Cytat
Register the DoctrineExtensions and Stof namespaces

Only required, when using submodules.


Dobra, na szybko instalacja przeszła, kroki:

# composer.json
Kod
"require": {
    "stof/doctrine-extensions-bundle": "dev-master",
}

potem w konsoli wykonujesz:
Kod
composer update
# ewentualnie
php composer.phar update


potem w pliku AppKernel.php:
  1. // app/AppKernel.php
  2. public function registerBundles()
  3. {
  4. return array(
  5. // ...
  6. new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
  7. // ...
  8. );
  9. }


i dalej już konfiguracja w pliku config.yml.


--------------------
Google knows the answer...
Go to the top of the page
+Quote Post
basso
post 26.01.2013, 15:26:51
Post #5





Grupa: Zarejestrowani
Postów: 155
Pomógł: 1
Dołączył: 12.12.2010

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


WItam,
no ... masz rację, okej mam to tak zrobione.

Teraz wrzucam w # app/config/config.yml Add the extensions to your mapping


Zamiast:
  1. # Doctrine Configuration
  2. #doctrine:
  3. # dbal:
  4. # driver: "%database_driver%"
  5. # host: "%database_host%"
  6. # port: "%database_port%"
  7. # dbname: "%database_name%"
  8. # user: "%database_user%"
  9. # password: "%database_password%"
  10. # charset: UTF8
  11. #
  12. # orm:
  13. # auto_generate_proxy_classes: "%kernel.debug%"
  14. # auto_mapping: true



Daję

  1. # app/config/config.yml
  2. doctrine:
  3. orm:
  4. entity_managers:
  5. default:
  6. mappings:
  7. gedmo_translatable:
  8. type: annotation
  9. prefix: Gedmo\Translatable\Entity
  10. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
  11. alias: GedmoTranslatable # this one is optional and will default to the name set for the mapping
  12. is_bundle: false
  13. gedmo_translator:
  14. type: annotation
  15. prefix: Gedmo\Translator\Entity
  16. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translator/Entity"
  17. alias: GedmoTranslator # this one is optional and will default to the name set for the mapping
  18. is_bundle: false
  19. gedmo_loggable:
  20. type: annotation
  21. prefix: Gedmo\Loggable\Entity
  22. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
  23. alias: GedmoLoggable # this one is optional and will default to the name set for the mapping
  24. is_bundle: false
  25. gedmo_tree:
  26. type: annotation
  27. prefix: Gedmo\Tree\Entity
  28. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
  29. alias: GedmoTree # this one is optional and will default to the name set for the mapping
  30. is_bundle: false




i wyskakuje:

  1. Whoops, looks like something went wrong.
  2.  
  3. 1/1ServiceNotFoundException: The service "cache_warmer" has a dependency on a non-existent service "doctrine".
  4. in C:\wamp\www\sym2\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\
    Compiler\CheckExceptionOnInvalidReferenceBehaviorPass.php line 59
  5. at CheckExceptionOnInvalidReferenceBehaviorPass->processReferences(array(object(Reference))) in C:\wamp\www\sym2\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\
    Compiler\CheckExceptionOnInvalidReferenceBehaviorPass.php line 43



Kurcze ni teraz nie wiem czy to miało być zamiast tamtego czy dodatkowo. Ale i tak i tak próbuje i ten sam błąd.
Go to the top of the page
+Quote Post
pedro84
post 26.01.2013, 17:01:52
Post #6





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

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


Wrzuć na pastebin swoją konfigurację, bo coś masz namieszane: AppKernel.php i config.yml. Jak mniemam Composer aktualizuje Ci paczki?


--------------------
Google knows the answer...
Go to the top of the page
+Quote Post
basso
post 26.01.2013, 17:47:00
Post #7





Grupa: Zarejestrowani
Postów: 155
Pomógł: 1
Dołączył: 12.12.2010

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


ooo dzięki,

Tutaj poniżej to czego potrzebujesz.

APP KERNEL => http://pastebin.com/CRGTG9ws
config.yml => http://pastebin.com/MfccS4gS
Go to the top of the page
+Quote Post
pedro84
post 26.01.2013, 17:55:11
Post #8





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

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


Odkomentuj konfigurację doctrine.dbal (na podstawie Twojego kodu: http://pastebin.com/2p6u6te7). Potem z konsoli:
Kod
php app/console cache:clear
i powinno śmigać.


--------------------
Google knows the answer...
Go to the top of the page
+Quote Post
basso
post 26.01.2013, 18:50:28
Post #9





Grupa: Zarejestrowani
Postów: 155
Pomógł: 1
Dołączył: 12.12.2010

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


Dzięki wielkie za poświęcony czas. Jest coraz lepiej... kurcze tak myślałem że ta tablica orm jest jedna...

Teraz wyskakuje MI :
Unknown Entity namespace alias 'BackendPagesBundle'.
500 Internal Server Error - ORMException


Czy przez zainstalowanie tego GEDMO muszę wszystko mieć na adnotacjach? Bo ja cały routing mam na .yml i takbym chciał mieć => jeśli się da.
Go to the top of the page
+Quote Post
pedro84
post 26.01.2013, 19:41:55
Post #10





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

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


Skądże. Zajrzyj do tego linka, powinien wiele wyjaśnić: http://stackoverflow.com/a/12616261/669422


--------------------
Google knows the answer...
Go to the top of the page
+Quote Post
basso
post 27.01.2013, 14:13:41
Post #11





Grupa: Zarejestrowani
Postów: 155
Pomógł: 1
Dołączył: 12.12.2010

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


Hej,
Z tego co mi podesłałeś to rozumiem, że w mapowaniu musi być cała ścieżka do Bundli.

Zatem miałem tak:

  1. orm:
  2. entity_managers:
  3. default:
  4. mappings:
  5. gedmo_translatable:
  6. type: annotation
  7. prefix: Gedmo\Translatable\Entity
  8. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
  9. alias: GedmoTranslatable # this one is optional and will default to the name set for the mapping
  10. is_bundle: false
  11. gedmo_translator:
  12. type: annotation
  13. prefix: Gedmo\Translator\Entity
  14. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translator/Entity"
  15. alias: GedmoTranslator # this one is optional and will default to the name set for the mapping
  16. is_bundle: false
  17. gedmo_loggable:
  18. type: annotation
  19. prefix: Gedmo\Loggable\Entity
  20. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
  21. alias: GedmoLoggable # this one is optional and will default to the name set for the mapping
  22. is_bundle: false
  23. gedmo_tree:
  24. type: annotation
  25. prefix: Gedmo\Tree\Entity
  26. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
  27. alias: GedmoTree # this one is optional and will default to the name set for the mapping
  28. is_bundle: false
  29.  


Teraz mam tak


  1. BackendPagesBundle:
  2. type: annotation
  3. prefix: Gedmo\Translatable\Entity
  4. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
  5. alias: GedmoTranslatable # this one is optional and will default to the name set for the mapping
  6. is_bundle: false
  7. BackendPagesBundle:
  8. type: annotation
  9. prefix: Gedmo\Translator\Entity
  10. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translator/Entity"
  11. alias: GedmoTranslator # this one is optional and will default to the name set for the mapping
  12. is_bundle: false
  13. BackendPagesBundle:
  14. type: annotation
  15. prefix: Gedmo\Loggable\Entity
  16. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
  17. alias: GedmoLoggable # this one is optional and will default to the name set for the mapping
  18. is_bundle: false
  19. BackendPagesBundle:
  20. type: annotation
  21. prefix: Gedmo\Tree\Entity
  22. dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
  23. alias: GedmoTree # this one is optional and will default to the name set for the mapping
  24. is_bundle: false
  25.  



I dalej to samo po wyczyszczeniu Cache. Mowa coś tam jest jeszcze o Shouldn't it be enough with auto_mapping: true? Tylko gdzie to wpisać?
Co jeśli mam więcej bundli , a mam .

Proszę o pomoc i z góry dziękuję.

Ten post edytował basso 27.01.2013, 14:18:34
Go to the top of the page
+Quote Post
pedro84
post 27.01.2013, 14:26:37
Post #12





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

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


Hej,

zobacz te zagadnienia na Githubie:
https://github.com/stof/StofDoctrineExtensi...ndle/issues/141
https://github.com/stof/StofDoctrineExtensi...ndle/issues/134
https://github.com/stof/StofDoctrineExtensi...to-your-mapping

Postawiłem teraz aplikację na SF, taki zapis działa dobrze:
Kod
# Doctrine Configuration
doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        auto_mapping: true
        mappings:
            StofDoctrineExtensionsBundle: ~


--------------------
Google knows the answer...
Go to the top of the page
+Quote Post
basso
post 2.02.2013, 10:41:57
Post #13





Grupa: Zarejestrowani
Postów: 155
Pomógł: 1
Dołączył: 12.12.2010

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


Działa mi sluggable, uaktywniłem jeszcze w config.yml



stof_doctrine_extensions:
default_locale: en_US
orm:
default:
sluggable: true


I śmiga.

Dzięki WIELKIE ZA POMOC exclamation.gif!
Go to the top of the page
+Quote Post
phpion
post 2.02.2013, 13:02:20
Post #14





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




@basso:
Na przyszłość proszę rozważniej przyznawać "Pomógł". Nie sądzę by:
Cytat
Jakimi błędami?

było dla Ciebie faktycznie pomocne...
Go to the top of the page
+Quote Post
basso
post 21.04.2013, 14:08:14
Post #15





Grupa: Zarejestrowani
Postów: 155
Pomógł: 1
Dołączył: 12.12.2010

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


A no chyba przegiąłem. Po prostu wklikiwałem smile.gif

Pytanie mam jeszcze jedno jak ktoś może pomóc. Próbowałem w kolejnych projektach instalować sluggable, ale wszędzie ten sam błąd.
To się pojawia przy zaciąganiu jak wpisuję: composer upadte, ciągnie ciągnie i przy końcu jak natrafia właśnie na kirshwall... to się wywala.



INSTALACJA STOF-A bez COMPOSERA.

Założyłem sobie nowy projekt.
1. Przeniosłem Stof z Vendorw do nowego projektu
2. Dodałem wpis w config i Kernel

I nie bardzo chce działać ten Stof. Oczywiście jak zapuszczę composerem to działa, tylko ja nie zawsze mam internet.

Pytanie:
1. Czy wie ktoś jak można zainstalować Stofa bez composer, gdzie jakie wpisy trzeba dać oprócz tych których dodałem ?[size="6"][/size][color="#FF0000"][/color]

Ten post edytował basso 21.04.2013, 14:23:16
Go to the top of the page
+Quote Post
semafor1985
post 22.04.2013, 10:23:20
Post #16





Grupa: Zarejestrowani
Postów: 61
Pomógł: 3
Dołączył: 18.10.2012
Skąd: Zagłębie Dąbrowskie

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


u mnie też wywalalo ten blad
zaaktualizowalem Symfony do najnowszej wersji
tam już chyba ten komponent nazywa się inaczej, jest w innym miejscu lub wogole go nie ma
i blad nie wsykakuje
Go to the top of the page
+Quote Post
basso
post 22.04.2013, 23:13:18
Post #17





Grupa: Zarejestrowani
Postów: 155
Pomógł: 1
Dołączył: 12.12.2010

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


Mówisz o Symfony 2.2 ? Dużo się różni od 2.1, bo nie wiem czy stofa mi się uda zainstalować ;/

Jak usunać katalogi .git z poziomu windowsa z zaciągniętych vendorów?


Faktycznie, w wersji 2.2 problem nie występuje. Zatem przerzucam się na wersję 2.2 smile.gif

Ten post edytował basso 22.04.2013, 23:23:22
Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 12.06.2025 - 17:27