Wednesday, December 23, 2009

Re: weird problem with paginator (Cake 1.3)

hi mark thx for the reply.

you said
"Well since you can't join across connections, that kind of makes
sense
doesn't it?"

so why the page is loading ok the first time, when there's no
paginator options in url? this problem occurs only when i try to sort
by Customer.name
obviously there isn''t any db-level link between customers and orders
tables because they're in different DBs but.... cake should map there
tabs anyway...

the thing that doesn't makes sense to me is:
- the data (even Customer.name) is loaded and showed correctly so this
field is present in data array but...
- paginator can't find (and sort) it...

"In any case I highly doubt your issue is specific to 1.3,
or even 1.2 and has much more to do with attempting to set order
clauses on tables that are not part of your pagination query. Check
your query to make sure all the required tables are in one query."

yes that's the problem. Paginator doesn't load my table even if the
relationship is correctly defined in "contain" subarray and
containable is loaded.

sry for my very bad eng.

-Ernesto

On 22 Dic, 15:11, mark_story <mark.st...@gmail.com> wrote:
> Well since you can't join across connections, that kind of makes sense
> doesn't it? In any case I highly doubt your issue is specific to 1.3,
> or even 1.2 and has much more to do with attempting to set order
> clauses on tables that are not part of your pagination query.  Check
> your query to make sure all the required tables are in one query.
>
> -Mark
>
> On Dec 22, 5:37 am, Ernesto <e.fanz...@gmail.com> wrote:
>
>
>
> > it looks like Paginator in 1.3 has a bug -> he's ignoring the models
> > using different DB connection
>
> > can anyone confirm this?
>
> > On 21 Dic, 17:08, Ernesto <e.fanz...@gmail.com> wrote:
>
> > > hello.
>
> > > my webapp has 3 models:
>
> > > Order, Item and Customer
>
> > > Order belongsTo Item
> > > Order belongsTo Customer
>
> > > both OrderModel and ItemModel are in app's models dir.
> > > CustomerModel is located in an external dir, defined in
> > > bootstrap.php's app build
>
> > > here's a piece of my OrdersController
>
> > > class OrdersController extends AppController {
> > >    [...]
> > >    var $paginate = array(
> > >       "limit" => 20,
> > >       "contain" => array(
> > >          "Item",
> > >          "Customer"
> > >       ),
> > >       "order" => "Order.Code"
> > >    )
>
> > >    function index() {
> > >       $this->set("orders", $this->paginate("Order"));
> > >    }
>
> > > }
>
> > > and here's a piece of my Orders index
>
> > > [...]
> > > <th><?php echo $paginator->sort("Order code", "Order.code") ?></th>
> > > <th><?php echo $paginator->sort("Customer", "Customer.name") ?></th>
> > > [...]
>
> > > if i click on "Order code" the page will work correctly and data will
> > > be displayed sorted by Order.Code
> > > if i click on "Customer" the page will return an error like "SQL
> > > Error: 1054: Unknown column 'Customer.name' in 'order clause'"
>
> > > i can't figure out the reason of this error...
>
> > > CustomerModel and CustomersController are working ok. i can insert/
> > > update/delete without errors.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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

No comments: