symfony - InternalServerError while trying to load data from database -
well started fosrestbundle in symfony still have lot of issues , hoping can explain few things me.
this routing.yml
app: resource: "@appbundle/controller/" type: annotation route_name: pattern: /test defaults: { _controller: appbundle:controller:afsprakencontroller:postafspraken, _format:json }
my config.yml
imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: services.yml } # put parameters here don't need change on each machine app deployed # http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration parameters: locale: en framework: serializer: enabled: true #esi: ~ #translator: { fallbacks: ["%locale%"] } secret: "%secret%" router: resource: "%kernel.root_dir%/config/routing.yml" strict_requirements: ~ form: ~ csrf_protection: ~ validation: { enable_annotations: true } #serializer: { enable_annotations: true } templating: engines: ['twig'] #assets_version: someversionscheme default_locale: "%locale%" trusted_hosts: ~ trusted_proxies: ~ session: # handler_id set null use default session handler php.ini handler_id: ~ fragments: ~ http_method_override: true # twig configuration twig: debug: "%kernel.debug%" strict_variables: "%kernel.debug%" # doctrine configuration doctrine: dbal: driver: pdo_mysql host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: utf8 # if using pdo_sqlite database driver: # 1. add path in parameters.yml # e.g. database_path: "%kernel.root_dir%/data/data.db3" # 2. uncomment database_path in parameters.yml.dist # 3. uncomment next line: # path: "%database_path%" orm: auto_generate_proxy_classes: "%kernel.debug%" naming_strategy: doctrine.orm.naming_strategy.underscore auto_mapping: true # swiftmailer configuration swiftmailer: transport: "%mailer_transport%" host: "%mailer_host%" username: "%mailer_user%" password: "%mailer_password%" spool: { type: memory } gregwar_captcha: ~ fos_rest: routing_loader: default_format: json view: formats: json: true rss: false # removing them work xml: false
and here controller:
<?php namespace appbundle\controller; use fos\restbundle\controller\fosrestcontroller; use symfony\component\httpfoundation\request; use fos\restbundle\view\view; use appbundle\response afspraakresponse; class afsprakencontroller extends fosrestcontroller { public function postafspraken(request $request) { $data = $this->getafspraken(); $view = $this->view($data, 200) ->settemplate("mybundle:users:getusers.html.twig") ->settemplatevar('users') ; return $this->handleview($view); } public function redirectaction() { $view = $this->redirectview($this->generateurl('getafspraken'), 301); return $this->handleview($view); } public function getafspraken() { $repository = $this->getdoctrine() ->getrepository('appbundle:uren'); $result = $repository->findall(); return $result; } }
when run localhost:8000/test whole page of errors honnest first line says this:
{"error":{"code":500,"message":"internal server error","exception":[{"message":"unable parse controller name \"appbundle:controller:afsprakencontroller:postafspraken\".","class":"logicexception"
what doing wrong render view of information of uren? , can explain doing wrong? new fosrestbundle , stack overflow doing best sorted
Comments
Post a Comment