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:
- ran
composer install
on 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 (
sites/all/modules/civicrm/vendor
); - copied the new entity's schema to the
xml/schema
folder; - altered the
Schema.xml
itself 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'
I.e. <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.php
on line 49Notice: Undefined index: _PEAR_default_error_mode in
<root>/CRM/Core/TemporaryErrorScope.php
on line 74Notice: Undefined index: _PEAR_default_error_options in
<root>/CRM/Core/TemporaryErrorScope.php
on line 75Warning: require_once(PEAR/ErrorStack.php): failed to open stream: No such file or directory in
<root>/CRM/Core/Error.php
on line 36Fatal 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 ErrorStack.php
file.
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.php
need in order to run properly? - is there another way to generate DAO and SQL files for new entities?
setup.sh
script runs for me as well (in a clean core clone, without even buildkit), the generation option (-g
) does not. I indeed added the buildkit bin folder to the relevant environment variable (PATH), but even so, the files I mentioned continue to be required. I am still considering if any of the buildkit scripts would generate these missing files...