Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php+symfony] konfiguracja StofDoctrineExtensionBundle dla zachowań: sluggable
dopelganger
post 23.09.2014, 12:16:49
Post #1





Grupa: Zarejestrowani
Postów: 236
Pomógł: 0
Dołączył: 27.10.2012

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


cześć
mam problem z konfiguracją StofDoctrineExtensionsBundle dla zachowania: sluggable....
wyskakuje błąd (chyba pluje się o config.yml):

InvalidArgumentException: There is no extension able to load the configuration for "default_locale" (in /home/www/.../app/config/config.yml). Looked for namespace "default_locale", found "framework", "security", "twig", "monolog", "swiftmailer", "assetic", "doctrine", "sensio_framework_extra"...

FileLoaderLoadException: Cannot import resource "/home/www/.../app/config/config.yml" from "/home/www/.../app/config/config_dev.yml". (There is no extension able to load the configuration for "default_locale" (in /home/www/.../app/config/config.yml). Looked for namespace "default_locale", found "framework", "security", "twig", "monolog", "swiftmailer", "assetic", "doctrine", "sensio_framework_extra", "stof_doctrine_extensions", "acme_demo", "web_profiler", "sensio_distribution")


kroki:
1. Zainstalowałem pakiet: Stof...
2. Dodałe do pliku AppKernel.php
  1. new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),

2. Zawartość: app/config/config.yml

  1. imports:
  2. - { resource: parameters.yml }
  3. - { resource: security.yml }
  4.  
  5. framework:
  6. #esi: ~
  7. #translator: { fallback: "%locale%" }
  8. secret: "%secret%"
  9. router:
  10. resource: "%kernel.root_dir%/config/routing.yml"
  11. strict_requirements: ~
  12. form: ~
  13. csrf_protection: ~
  14. validation: { enable_annotations: true }
  15. templating:
  16. engines: ['twig']
  17. #assets_version: SomeVersionScheme
  18. default_locale: "%locale%"
  19. trusted_hosts: ~
  20. trusted_proxies: ~
  21. session:
  22. # handler_id set to null will use default session handler from php.ini
  23. handler_id: ~
  24. fragments: ~
  25. http_method_override: true
  26.  
  27. # Twig Configuration
  28. twig:
  29. debug: "%kernel.debug%"
  30. strict_variables: "%kernel.debug%"
  31.  
  32. # Assetic Configuration
  33. assetic:
  34. debug: "%kernel.debug%"
  35. use_controller: false
  36. bundles: [ ]
  37. #java: /usr/bin/java
  38. filters:
  39. cssrewrite: ~
  40. #closure:
  41. # jar: "%kernel.root_dir%/Resources/java/compiler.jar"
  42. #yui_css:
  43. # jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
  44.  
  45. # Doctrine Configuration
  46. doctrine:
  47. dbal:
  48. driver: "%database_driver%"
  49. host: "%database_host%"
  50. port: "%database_port%"
  51. dbname: "%database_name%"
  52. user: "%database_user%"
  53. password: "%database_password%"
  54. charset: UTF8
  55. # if using pdo_sqlite as your database driver, add the path in parameters.yml
  56. # e.g. database_path: "%kernel.root_dir%/data/data.db3"
  57. # path: "%database_path%"
  58.  
  59. orm:
  60. auto_generate_proxy_classes: "%kernel.debug%"
  61. auto_mapping: true
  62. mappings: StofDoctrineExtensionsBundle: true
  63.  
  64. stof_doctrine_extensions:
  65. default_locale: en_US
  66. orm:
  67. default:
  68. tree: true
  69. loggable: true
  70. timestampable: true
  71. sluggable: true
  72. translateable: true
  73.  
  74. # Swiftmailer Configuration
  75. swiftmailer:
  76. transport: "%mailer_transport%"
  77. host: "%mailer_host%"
  78. username: "%mailer_user%"
  79. password: "%mailer_password%"
  80. spool: { type: memory }
  81.  


czy należy jeszcze coś skonfigurować itd?
dzięki
Go to the top of the page
+Quote Post
pedro84
post 23.09.2014, 12:21:47
Post #2





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

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


Masz SF 2.0? default_locale jest dostępne od wersji 2.1:
http://symfony.com/doc/2.0/reference/confi.../framework.html
http://symfony.com/doc/2.1/reference/confi.../framework.html.

Tutaj masz zwalone wcięcia w Yamlu:
Kod
stof_doctrine_extensions:
default_locale: en_US
orm:
default:
tree: true
loggable: true
timestampable: true
sluggable: true
translateable: true


Ten post edytował pedro84 23.09.2014, 12:24:26


--------------------
Google knows the answer...
Go to the top of the page
+Quote Post
destroyerr
post 23.09.2014, 12:25:16
Post #3





Grupa: Zarejestrowani
Postów: 879
Pomógł: 189
Dołączył: 14.06.2006
Skąd: Bytom

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


Raczej podejrzewałbym złe sformatowanie pliku yaml.
Go to the top of the page
+Quote Post
dopelganger
post 23.09.2014, 12:36:09
Post #4





Grupa: Zarejestrowani
Postów: 236
Pomógł: 0
Dołączył: 27.10.2012

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


Cytat(pedro84 @ 23.09.2014, 13:21:47 ) *
Masz SF 2.0? default_locale jest dostępne od wersji 2.1:
http://symfony.com/doc/2.0/reference/confi.../framework.html
http://symfony.com/doc/2.1/reference/confi.../framework.html.

Tutaj masz zwalone wcięcia w Yamlu:
Kod
stof_doctrine_extensions:
default_locale: en_US
orm:
default:
tree: true
loggable: true
timestampable: true
sluggable: true
translateable: true


raczej nowe S, tylko korzystam z książki Gajdy a tam jest starsza wersja


Cytat(dopelganger @ 23.09.2014, 13:34:11 ) *
raczej nowe S, tylko korzystam z książki Gajdy a tam jest starsza wersja



czy wcięcia grają role?
bo spotkałem sie już z Symfony jak robiłem w Pajączku to wypierd... błędy
dopiero jak w notatniku jechałem to było git,,,
tylko ciupanie w notatniku to katorga :/
Go to the top of the page
+Quote Post
Turson
post 23.09.2014, 12:42:07
Post #5





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

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


A to nie ma innych edytorów tekstowych oprócz Pajączka i notatnika? Chociażby notepad++...
Go to the top of the page
+Quote Post
dopelganger
post 23.09.2014, 13:54:07
Post #6





Grupa: Zarejestrowani
Postów: 236
Pomógł: 0
Dołączył: 27.10.2012

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



udało mi się tak:

  1. orm:
  2. auto_generate_proxy_classes: "%kernel.debug%"
  3. auto_mapping: true
  4.  
  5. mappings:
  6. StofDoctrineExtensionsBundle: ~
  7.  
  8. stof_doctrine_extensions:
  9. default_locale: pl_PL
  10. orm:
  11. default:
  12. tree: false
  13. loggable: false
  14. timestampable: false
  15. sluggable: true
  16. translatable: true


tylko teraz jak dodam do klasy Name.php :
  1. class Name
  2. {
  3.  
  4. /**
  5. * @Gedmo\Slug(fields={"title"})
  6. * @ORM\Column(length=128,unique=true)
  7. */
  8. private $slug;


to wywala:

[Semantical Error] The annotation "@Gedmo\Slug" in property My3\PageBundle\Entity\Name::$slug was never imported. Did you maybe forget to add a "use" statement for this annotation?

Ten post edytował dopelganger 23.09.2014, 13:54:53
Go to the top of the page
+Quote Post
pitu
post 23.09.2014, 14:00:13
Post #7





Grupa: Zarejestrowani
Postów: 476
Pomógł: 96
Dołączył: 10.04.2008
Skąd: Koszalin

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


Dodałeś w entity use:
Kod
use Gedmo\Mapping\Annotation as Gedmo;


--------------------
HTML/CSS/JS: jsfiddle
SQL: sqlfiddle
Go to the top of the page
+Quote Post
dopelganger
post 23.09.2014, 14:00:54
Post #8





Grupa: Zarejestrowani
Postów: 236
Pomógł: 0
Dołączył: 27.10.2012

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


działa !

zamykamy , JUPI!!!!!



Ten post edytował dopelganger 23.09.2014, 14:10:49
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: 28.03.2024 - 11:31