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 ...
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
...
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 ...
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 ...
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 ...
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.
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 '...
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 ...
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 ...
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 ...
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 ...
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.
...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
coding-standards × 15php × 9
permissions × 2
best-practice × 2
api × 1
extension × 1
relationships × 1
developer × 1
4.7 × 1
smarty × 1
javascript × 1
settings × 1
fields × 1
testing × 1
apiv4 × 1
unit-testing × 1
4.6.10 × 1
autoloading × 1