Symfony1 symfony:尝试使用我自己的方法在后端显示列表。未定义抵销通知

Symfony1 symfony:尝试使用我自己的方法在后端显示列表。未定义抵销通知,symfony1,backend,Symfony1,Backend,我正在尝试使用自己的方法在后端显示列表: 类ShopOrderPeer扩展了BaseShopOrderPeer{ public static function getOrdini() { $con = Propel::getConnection(); $sql = "select customers_name, value, date_purchased, orders_status from shop_orders LEFT JOIN shop_orders_total ON

我正在尝试使用自己的方法在后端显示列表:

类ShopOrderPeer扩展了BaseShopOrderPeer{

public static function getOrdini()
{
    $con = Propel::getConnection();
    $sql = "select customers_name, value, date_purchased, orders_status from shop_orders LEFT JOIN shop_orders_total  ON shop_orders.orders_id = shop_orders_total.orders_id";
    $stmt = $con->prepare($sql);

    $result = $stmt->execute();
    $ordini = self::populateObjects($stmt);


    return $ordini;

}
}

这是我的发电机

generator:
  class: sfPropelGenerator
  param:
    model_class:           ShopOrder
    theme:                 admin
    non_verbose_templates: true
    with_show:             false
    singular:              ShopOrder
    plural:                ShopOrders
    route_prefix:          shop_order
    with_propel_route:     1
    actions_base_class:    sfActions

    config:
      actions: ~
      fields:  ~
      list:
        display: [customers_name, date_purchased, orders_status ]
        peer_method:  getOrdini
      filter:  ~
      form:    ~
      edit:    ~
      new:     ~
当我加载列表页面时,会显示列表,但我会收到此错误消息

Notice: Undefined offset: 4 in /home/javier/Aptana_Studio_Workspace/dev_repo/lib/model/om/BaseShopOrder.php on line 1864
Call Stack
#  Time  Memory  Function  Location
1  0.0017  324556  {main}( )  ../backend_dev.php:0
2  0.0891  4457868  sfContext->dispatch( )  ../backend_dev.php:13
3  0.0891  4457912  sfFrontWebController->dispatch( )  ../sfContext.class.php:170
4  0.0892  4464168  sfController->forward( )  ../sfFrontWebController.class.php:48
5  0.1181  5054656  sfFilterChain->execute( )  ../sfController.class.php:229
6  0.1188  5061248  sfRenderingFilter->execute( )  ../sfFilterChain.class.php:53
7  0.1188  5061248  sfFilterChain->execute( )  ../sfRenderingFilter.class.php:33
8  0.1191  5070452  sfBasicSecurityFilter->execute( )  ../sfFilterChain.class.php:53
9  0.1192  5070496  sfFilterChain->execute( )  ../sfBasicSecurityFilter.class.php:72
10  0.1196  5082256  sfExecutionFilter->execute( )  ../sfFilterChain.class.php:53
11  0.2778  11817440  sfExecutionFilter->handleView( )  ../sfExecutionFilter.class.php:47
12  0.2778  11817440  sfExecutionFilter->executeView( )  ../sfExecutionFilter.class.php:116
13  0.2815  11859256  sfPHPView->render( )  ../sfExecutionFilter.class.php:155
14  0.2815  11859632  sfPHPView->renderFile( )  ../sfPHPView.class.php:179
15  0.2855  11973804  require('/home/javier/Aptana_Studio_Workspace/dev_repo/cache/backend/dev/modules/autoOrdini/templates/indexSuccess.php')  ../sfPHPView.class.php:75
16  3.0826  115065148  include_partial( )  ../indexSuccess.php:19
17  3.0826  115065148  get_partial( )  ../PartialHelper.php:180
18  3.0831  115068964  sfPartialView->render( )  ../PartialHelper.php:218
19  3.0832  115070248  sfPHPView->renderFile( )  ../sfPartialView.class.php:110
20  3.0866  115161828  require( '/home/javier/Aptana_Studio_Workspace/dev_repo_cashgold/cache/backend/dev/modules/autoOrdini/templates/_list.php' )  ../sfPHPView.class.php:75
21  3.6215  115636256  sfPropelPager->getResults( )  ../_list.php:28
22  3.6215  115636668  call_user_func ( )  ../sfPropelPager.class.php:117
23  3.6216  115636696  ShopOrderPeer::getOrdini( )  ../sfPropelPager.class.php:0
24  3.6227  115676928  BaseShopOrderPeer::populateObjects( )  ../ShopOrderPeer.php:31
25  3.6229  115684084  BaseShopOrder->hydrate( )
然后:

注意:未定义的偏移量:5注意: 未定义的偏移量:6

这是BaseShopOrder.php文件

try {

            $this->orders_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
            $this->sfgu_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
            $this->utenti_email = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
            $this->utenti_telefono = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
            $this->customers_name = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;            // line 1864
            $this->customers_company = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
            $this->customers_street_address = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
            $this->customers_suburb = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
            $this->customers_city = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
            $this->customers_postcode = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
            $this->customers_state = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
            $this->customers_country = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
有什么想法吗

Javi

SomePeer::populateObjects()设计用于SomePeer::doSelect()

populateObjects()期望查询包含所查询表中存在的所有列。这就是为什么要从。。。他为你工作

但是,不建议您采取变通办法,因为如果由于某种原因数据库中列的顺序发生更改,则数据库将以与populateObjects()所期望的不同的顺序返回列

编写Criteria对象要安全得多。然后,如果您愿意,您可以使用对等方法addSelectColumns,但是如果您使用doSelect。。。从你的同班同学那里得到的

推进网站有一些关于标准的好文档,只需检查您首先安装的推进版本


解决方法:不要选择客户名称、价值、购买日期、来自店铺的订单状态、订单左加入…,而是选择*左加入。。。