I have been trying to generate DAO and SQL files for an entity I created with
civix generate:entity ... according to the documentation ("Add a new entity" - 4.d.).
Using the latest civicrm-core clone (latest commit e637260) I:
composer installon the root (civiroot);
- verified that the vendor folder has the same packages that come along with, for example, CiviCRM 4.7.20 for Drupal 7.x (
- copied the new entity's schema to the
- altered the
Schema.xmlitself to include this entity.
However, after running
bash bin/setup.sh -g or
php xml/GenCode.php this comes up:
Fatal error: require_once(): Failed opening required 'Log.php'
<root>/CRM/Core/Config.php is expecting:
require_once 'Log.php'; require_once 'Mail.php';
I searched for a while and I could not find these files, so I just thought of trying it out without these lines from
Config.php, but once I rerun I got:
Notice: Use of undefined constant PEAR_ERROR_CALLBACK - assumed 'PEAR_ERROR_CALLBACK' in
<root>/CRM/Core/TemporaryErrorScope.phpon line 49
Notice: Undefined index: _PEAR_default_error_mode in
<root>/CRM/Core/TemporaryErrorScope.phpon line 74
Notice: Undefined index: _PEAR_default_error_options in
<root>/CRM/Core/TemporaryErrorScope.phpon line 75
Warning: require_once(PEAR/ErrorStack.php): failed to open stream: No such file or directory in
<root>/CRM/Core/Error.phpon line 36
Fatal error: require_once(): Failed opening required 'PEAR/ErrorStack.php' (include_path='
.:<root>:<root>/packages:<root>/vendor/tecnickcom:<root>/vendor/phpseclib/phpseclib/phpseclib:<root>/vendor/pear/pear_exception:<root>/vendor/pear/auth_sasl:<root>/vendor/pear/validate_finance_creditcard:.:../packages:..') in /CRM/Core/Error.php on line 36
I did find a PEAR folder but it is in
<root>/vendor/pear/pear_exception/PEAR, without any
I also found a couple of related questions in here:
- How to automatically generate DAO classes for my DB tables
- How do I add a new table to my extension?
In the last one, I understand that people seem to run the code generator without such problems.
I apologize the long question, TLDR;
- what am I missing? What does
GenCode.phpneed in order to run properly?
- is there another way to generate DAO and SQL files for new entities?