Symfony Bundles Cookbook

From Littledamien Wiki
Revision as of 19:51, 19 March 2014 by Video8 (talk | contribs) (Created page with "== Overview == Topics related to working with bundles in Symfony. == Generating a new bundle skeleton == === Basic syntax === <syntaxhighlight lang="powershell"> d:\path\t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Topics related to working with bundles in Symfony.

Generating a new bundle skeleton

Basic syntax

d:\path\to\webroot\> php app/console generate:bundle

N.B. The generate:bundle command takes a long time to execute and send a response.

Bundle properties

The generate:bundle command without any arguments will enter into interactive mode and respond with a series of prompts for the bundle properties.

  • namespace "vendor" followed by one or more optional category sub-namespaces followed by the bundle name.
    • Vendor is a company name, project name, client name, etc. specific to the website and/or project
    • Sub-namespaces organize related bundles
    • The bundle name must end in "Bundle".
    • E.g. NorthRose/Billing/InvoiceBundle
  • Bundle name name used to reference the bundle. Should be unique. Convention is to concatenate all of the namespace parts, e.g. NorthRoseInvoiceBundle.
  • Target directory Default convention is in /src/.
  • Configuration format yml, xml, php, etc. Convention is to use yml.
  • Do you want to generate the whole directory structure? This will create a complete directory structure including empty public folders for documentation, web assets, etc. Shortcut to create skeleton structure.

Permissions

Working remotely on Windows, it's necessary to make sure that some of the directories under /app/ have write permissions:

  • /app/cache/
  • /app/logs/
  • Remote desktop to the server.
  • Explorer > navigate to the app directory.
  • Right click on the subdirectory > Properties > Security tab > Edit > Users > add "Modify" permissions

See also