CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • civix doesn't generate the expected code for custom search on 4.3
Pages: [1]

Author Topic: civix doesn't generate the expected code for custom search on 4.3  (Read 1812 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
civix doesn't generate the expected code for custom search on 4.3
June 06, 2013, 05:01:13 am
the "out of the box" civix search on 4.3 results in:

Fatal error: Declaration of CRM_Mycustomsearch::all() must be compatible with that of CRM_Contact_Form_Search_Interface::all()

when you try to use it.
Digging....
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civix doesn't generate the expected code for custom search on 4.3
June 07, 2013, 12:24:49 am
Fix on its way

https://github.com/totten/civix/pull/13
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: civix doesn't generate the expected code for custom search on 4.3
June 14, 2013, 08:57:20 am
So the problem is that the interface for custom-searches changed between v4.2 and v4.3 (specifically https://fisheye2.atlassian.com/changelog/CiviCRM?cs=44025 ). We discussed and did some quick testing on the significance of this. It looks like:

 * Custom-search classes written with the new function signature (v4.3) will work with the old Interface.php (v4.2).
 * Custom-search classes written with the old function signature (v4.2) will produce errors when used with the new Interface.php (v4.3).

We drew this conclusion from some basic testing of PHP's class/interface handling. For example, this code runs without error:

Code: [Select]
// old style interface (missing the param)
interface Foo {
  function a();
}

// new style implementation (with the param)
class Bar implements Foo {
  function a($a = '') {
  }
}

but this code produces a fatal error:

Code: [Select]
// new style interface (with the param)
interface Foo {
  function a($a = '');
}

// old style implementation (missing the param)
class Bar implements Foo {
  function a() {
  }
}
« Last Edit: June 14, 2013, 09:00:57 am by totten »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civix doesn't generate the expected code for custom search on 4.3
June 14, 2013, 09:10:36 am
We have decided to add changes on the public classes into the api change log

http://wiki.civicrm.org/confluence/display/CRMDOC43/API+changes#APIchanges-4.3.0CRM_Contact_Form_Search_Interface::all
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • civix doesn't generate the expected code for custom search on 4.3

This forum was archived on 2017-11-26.