Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql Propel 1.7用于访问相关对象的方法名称的双复数_Mysql_Propel - Fatal编程技术网

Mysql Propel 1.7用于访问相关对象的方法名称的双复数

Mysql Propel 1.7用于访问相关对象的方法名称的双复数,mysql,propel,Mysql,Propel,我正在使用(第一次)随安装提供的propel 1.7和propel gen shell脚本。schema.xml是使用spreep gen reverse从现有数据库生成的,之后使用spreep gen om生成类 我的数据库结构是以这样一种方式构建的,它为一个单独的表中的各种数据提供翻译,并具有一对多的关系。 这是一个例子: TABLE 'buildings' 'id' int(10) unsigned NOT NULL AUTO_INCREMENT, 'address' varcha

我正在使用(第一次)随安装提供的propel 1.7和propel gen shell脚本。schema.xml是使用
spreep gen reverse
从现有数据库生成的,之后使用
spreep gen om
生成类

我的数据库结构是以这样一种方式构建的,它为一个单独的表中的各种数据提供翻译,并具有一对多的关系。 这是一个例子:

TABLE 'buildings'
  'id' int(10) unsigned NOT NULL AUTO_INCREMENT,
  'address' varchar(255) NOT NULL,

TABLE 'building_description_translations'
  'building_id' int(10) unsigned NOT NULL,
  'lang' varchar(2) NOT NULL,
  'description' varchar(1023) NOT NULL,
building\u description\u translations.building\u id
有一个指向
buildings.id
的外键。另外,
building\u description\u translations
的主键位于
building\u id
lang
列上

到目前为止,propel generator的工作非常出色,只是用于从关系访问相关对象的方法名最终被复数化了两次:

// file build/classes/myproject/om/BaseBuildings
class BaseBuildings{
    //...

    // note the TranslationSS
    public function getBuildingDescriptionTranslationss($criteria = null, PropelPDO $con = null)
    {
    //...
    }   

}
此外,我的build.properties文件看起来像(除了数据库配置):


有没有一种方法可以在不干扰现有数据库模式的情况下控制这种双重多元化?我已经搜索了答案,但找不到与此场景相关的任何内容。

我找到了答案-最简单的方法是基于位于

生成器\lib\builder\util\StandardEnglishPlus.php

让我们假设新的多元化是

generator\lib\builder\util\MyEnglishPluralizer.php

build.properties
中,需要相应地更改乘法器配置

spreep.builder.pluralizer.class=builder.util.MyEnglishPluralizer

然后,使用
om

在我的例子中,我只需要在
$\u复数
属性中添加一个条目

protected $_plural = array(
        // ...
        'ons' => 'ons'
    );
注意:我使用了推进安装附带的
spreep gen
脚本,而不是PEAR软件包中的脚本

protected $_plural = array(
        // ...
        'ons' => 'ons'
    );