Workaround: instead of "select customers_name, value, date_purchased,
orders_status from shop_orders LEFT JOIN ...", "select * LEFT
JOIN ..."

On 6 Dic, 18:39, Javier Garcia <tirengar...@gmail.com> wrote:
> Hi,
>
> i'm trying to use my own method to show a list in the backend:
>
> class ShopOrderPeer extends 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;
>
>     }
>
> }
>
> And this is my generator.yml
>
> 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:     ~
>
> When i load the page of the list, the list is showed but I get this
> erro messages
>
> 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( )
>
> And then:
>
> Notice: Undefined offset: 5
> Notice: Undefined offset: 6
> ....
>
> This is the file 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;
>
> Any idea?
>
> Javi

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to