5

I'm bit of a CiviCRM noob, but I'd like to help out and fit with the current patterns. I keep encountering bits of Symfony in core code and it seems well respected... and pretty cool.

So far I have identified these in the core:

and I'm sure there is more.

The cool build kit tools seem based on the console component too.

So the question is:

How much symphony magic, and which bits, are worth understanding?

If that question is too open: Are there bits that have been rejected for another approach?

2 Answers 2

6

Those are the three that we use now, although I'd usually prefer to read the guides rather than the autogenerated API docs, i.e.

This blog from civicrm.org is probably relevant: The static is dead. Long live the static!

To date, most of the Symfony usage has been internal -- e.g. Civi\Core\Container originally followed a... radically minimalist approach (verging on antipattern) by putting all the service definitions in one PHP file. But it's starting to open up a bit for downstream dev:

  • v4.7 introduced hook_civicrm_container
  • cv recently added subcommands for debug:container and debug:event-dispatcher

However, I don't regard it as consumer-friendly right now because all service-definitions and event-listeners are declared in PHP code. I'd really prefer (a) bindings for YAML/JSON/XML files and (b) some kind of autowiring for the dependency injection.

9

You must be digging pretty deep if you're running into Symfony. Its introduction into the stack is fairly new. CiviCRM has been around for over ten years, so some of the technologies are pretty hip and new (like Symfony) and some of the technologies, like Smarty or PEAR DB... well, not so much.

I think I've run into Symfony in some code around events (like... programming events, not CiviEvents) and maybe in some of the new command line tools. If your primary concern is fixing bugs, you may never even see it, as many of the bugs tend to live in older code.

Bottom line: It's a technology the core team would like to adopt, but adoption is happening slowly. I wouldn't say that Symfony experience is a prerequisite for developing CiviCRM any more than AngularJS experience is.

1
  • I like it deep @GinkoFJG Feb 1, 2017 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.