Drukowana wersja tematu

Kliknij tu, aby zobaczyć temat w orginalnym formacie

Forum PHP.pl _ PHP _ [php+symfony] konfiguracja StofDoctrineExtensionBundle dla zachowań: sluggable

Napisany przez: dopelganger 23.09.2014, 12:16:49

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

Napisany przez: pedro84 23.09.2014, 12:21:47

Masz SF 2.0? default_locale jest dostępne od wersji 2.1:
http://symfony.com/doc/2.0/reference/configuration/framework.html
http://symfony.com/doc/2.1/reference/configuration/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

Napisany przez: destroyerr 23.09.2014, 12:25:16

Raczej podejrzewałbym złe sformatowanie pliku yaml.

Napisany przez: dopelganger 23.09.2014, 12:36:09

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/configuration/framework.html
http://symfony.com/doc/2.1/reference/configuration/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 :/

Napisany przez: Turson 23.09.2014, 12:42:07

A to nie ma innych edytorów tekstowych oprócz Pajączka i notatnika? Chociażby notepad++...

Napisany przez: dopelganger 23.09.2014, 13:54:07


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?

Napisany przez: pitu 23.09.2014, 14:00:13

Dodałeś w entity use:

Kod
use Gedmo\Mapping\Annotation as Gedmo;

Napisany przez: dopelganger 23.09.2014, 14:00:54

działa !

zamykamy , JUPI!!!!!


Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)