Skip to content

Commit

Permalink
generate:entity should provide empty DAO along with empty BAO
Browse files Browse the repository at this point in the history
  • Loading branch information
totten committed Jun 26, 2024
1 parent 0a3907e commit 6d3a994
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CRM/CivixBundle/Command/AddEntityCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
if (in_array('4', $apiVersions)) {
$ext->builders['api4.php'] = new Template('entity-api4.php.php', $ctx['api4File'], FALSE, Civix::templating());
}
$ext->builders['dao.php'] = new Template('entity-dao.php.php', $ctx['daoClassFile'], FALSE, Civix::templating());
$ext->builders['bao.php'] = new Template('entity-bao.php.php', $ctx['baoClassFile'], FALSE, Civix::templating());
$ext->builders['entity.xml'] = new Template('entity-schema.xml.php', $ctx['schemaFile'], FALSE, Civix::templating());

Expand Down
18 changes: 18 additions & 0 deletions src/CRM/CivixBundle/Resources/views/Code/entity-dao.php.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
echo "<?php\n";
$_namespace = preg_replace(':/:', '_', $namespace);
?>
use <?php echo $_namespace ?>_ExtensionUtil as E;

/**
* DAOs provide an OOP-style facade for reading and writing database records.
*
* DAOs are a primary source for metadata in several versions of CiviCRM (<5.75)
* and are required for some subsystems (such as APIv3).
*
* This stub provides compatibility. It is not intended to be modified in a
* substantive way. However, you may add comments and annotations.
*/
class <?php echo $daoClassName ?> extends CRM_Core_DAO {

}

0 comments on commit 6d3a994

Please sign in to comment.