9 votes

How much symfony do I need to learn if I am going to be a CiviCRM core hacker?

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 ...
universalhandle's user avatar
6 votes
Accepted

How much symfony do I need to learn if I am going to be a CiviCRM core hacker?

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. Symfony Service Container Symfony Event Dispatcher Symfony Console ...
Tim Otten's user avatar
  • 5,664
6 votes
Accepted

What versions of PHP are used in CiviCRM's internal QA?

At time of writing, all PRs tests and scheduled tests run under Ubuntu 12.04 (PHP 5.3.10). There is an effort underway to introduce a test node for Ubuntu 16.04 (PHP 7.0) (although details are still a ...
Tim Otten's user avatar
  • 5,664
6 votes

What is the recommended level of PHP for CiviCRM? There seems to be some inconsistencies

CiviCRM PHP requirements recommends PHP5.5 or greater, and notes PHP5.3.10 is the bare minimum required. As well as this, you want to be sure your PHP version is actively getting security updates, and ...
Chris Burgess's user avatar
5 votes
Accepted

Class naming and namespaces: best practice as an extension author?

The conventional approach Generally, the safe play is to make a file like <myextension>/CRM/MyExtension/MyClass.php: <?php class CRM_MyExtension_MyClass { ...} (Be sure to match the ...
Tim Otten's user avatar
  • 5,664
3 votes

api4: get(FALSE) vs get()->setCheckPermissions(FALSE): which is preferred?

Core tends to use the short form but both are equally valid. The short form was introduced later just because it comes up so often that you want to set it to false.
Demerit's user avatar
  • 21.8k
3 votes
Accepted

private or protected class properties

I think submitting a PR to make this variable protected would be perfectly reasonable. Alternatively, there is a way to access private properties in PHP for the sake of unit testing via Reflection. ...
Coleman's user avatar
  • 17.6k
3 votes
Accepted

best practice for using core base functions (CRM_Utils_System_Base) from an extension?

This base class is not intended to be used by itself, but extended based on the CMS. CiviCRM will automatically give you an instance of the correct object which extends this base class. You can access ...
Coleman's user avatar
  • 17.6k
3 votes
Accepted

Smarty and future proof code

Going forward, much of the Civi UI will be written in Angular. However at least 95% of the application uses Smarty and it's still a perfectly acceptable way to mark up a form or page. Depending on ...
Coleman's user avatar
  • 17.6k
2 votes
Accepted

What are the core functions an extension can rely on?

Yes, SE isn't designed to have three questions in one, as this leads to a knotted ball of yarn. API calls are intended to have unchanging interfaces for the life of that version of the API, once the ...
Joe Murray's user avatar
  • 6,731
2 votes

best practice for using core base functions (CRM_Utils_System_Base) from an extension?

It's probably easier to answer based on a specific need rather than your more generic "hey, found a stash of toys, can I play with them? ;)" They are a few that you shouldn't use directly but use the ...
Xavier's user avatar
  • 10.2k
2 votes

how do I use phpcbf?

The phpcs/phpcbf standard in use is a modified Drupal standard, so you call the standard of "Drupal": phpcbf --standard="Drupal" filename.php However, if you ALSO have unmodified copies of the ...
Jon G - Megaphone Tech's user avatar
2 votes
Accepted

BAO vs API layer

The API should really only apply logic that can be derived from the metadata - ie. the api applies defaults, enforces required fields, maps names of option values to the values. Any logic that is '...
user4278's user avatar
  • 1,021
2 votes
Accepted

CiviCRM Individual Contact Inherits fields from Organisation

CiviCRM offers the option of having a Shared Address but there is no way out of the box to trigger that automatically (that I am aware of). Depending on how you are adding Contacts if you were using ...
petednz - fuzion's user avatar
  • 28.1k
2 votes

Should I use Civi::settings()->get and set or

Thanks @Jon G, that makes sense :-) So summarizing the recommended way is: Register metadata for setting using hook_civicrm_alterSettingsMetaData or create myfile.setting.php in my extension Use ...
ErikH - CiviCooP's user avatar
2 votes

Should I use Civi::settings()->get and set or

One option is to create settings using Setting Reference How I would do through extension is Register metadata for setting using hook_civicrm_alterSettingsMetaData To set the setting using civicrm ...
Pradeep Nayak's user avatar
1 vote
Accepted

Why is the entity.action permission sparse?

I like the table. It would be really cool if that information were available inline as part of the "API Explorer" -- eg when you inspect the Activity.create API, you'd be able to further review the ...
Tim Otten's user avatar
  • 5,664
1 vote

how do I use phpcbf?

One use of phpcbf is as a way to automatically format (or'beautify' the code you write in your editor (providing your editor supports it). For example, Atom supports phpcbf via the beautify package. ...
michaelmcandrew's user avatar
1 vote

Should I use Civi::settings()->get and set or

Instead of hook_civicrm_alterSettingsMetaData you can also create a myfile.setting.php file in your extension. See also issue core#495 for recent work that allows you to add settings to the UI based ...
Jon G - Megaphone Tech's user avatar
1 vote

What is the recommended level of PHP for CiviCRM? There seems to be some inconsistencies

Chris' answer is correct. However, a coworker reported at least one instance of an extension that did not run correctly on PHP 5.3 (I'm afraid I don't know which), so this answer applies to core ...
Jon G - Megaphone Tech's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible