Re: Easy cake pagination!

2010-08-21 Thread Okalany Daniel
On Thu, Aug 19, 2010 at 8:06 PM, bradmaxs  wrote:

> Does your Count model have a count field and if so, how does that
> relate to Place?  I am a little confused about what you are trying to
> do.  Does your Count model have a place_id for the relationship
> reference?
>
> Yes, my Count model has a field count. and yes, there is a place_id field
with the belongs two relationship.

> One thing you could try is in the hasMany array in the Place model you
> could always declare the order there.
>
> var $hasMany = array(
>'Count' => array(
>'className' => 'Count',
>'foreignKey' => 'place_id',
>'order' => 'Count.count ASC',
>)
> );
>
> I'm trying to order based on the value of the child relationship.
I'm tracking daily hits for a place. So im trying to retrieve the places by
the place with the highest hits on a particular day.
I can do ->find() without problems and with the same options, but paginate
is troublesome.

>
>
>
>
>
>
> http://book.cakephp.org/view/1043/hasMany
>
> On Aug 19, 4:42 am, Okalany Daniel  wrote:
> > The SQL Query generated doesn't have a join:
> >
> > *Warning* (512) : *SQL Error:* 1054: Unknown
> > column 'Count.count' in 'order clause'
> > [*CORE\cake\libs\model\datasources\dbo_source.php*, line *673*]
> > Code  | Context 
> >
> > $out = null;if ($error) {
> > trigger_error('' . __('SQL
> > Error:', true) . " {$this->error}", E_USER_WARNING);
> >
> > $sql=   "SELECT `Place`.`id`, `Place`.`name`, `Place`.`guy_count`
> FROM
> > `places` AS `Place`   WHERE 1 = 1   ORDER BY `Count`.`count` ASC "
> > $error  =   "1054: Unknown column 'Count.count' in 'order clause'"
> > $out=   null
> >
> > DboSource::showQuery() -
> > CORE\cake\libs\model\datasources\dbo_source.php, line 673
> > DboSource::execute() - CORE\cake\libs\model\datasources\dbo_source.php,
> line 263
> > DboSource::fetchAll() -
> > CORE\cake\libs\model\datasources\dbo_source.php, line 407
> > DboSource::read() - CORE\cake\libs\model\datasources\dbo_source.php, line
> 812
> > Model::find() - CORE\cake\libs\model\model.php, line 2090
> > PlacesController::index() - APP\controllers\places_controller.php, line
> 16
> > Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> > Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> > [main] - APP\webroot\index.php, line 83
> >
> > *Query:* SELECT `Place`.`id`, `Place`.`name`, `Place`.`guy_count` FROM
> > `places` AS `Place`   WHERE 1 = 1   ORDER BY `Count`.`count` ASC
> >
> >
> >
> >
> >
> > On Wed, Aug 18, 2010 at 8:59 PM, bradmaxs  wrote:
> > > What fields do you have in the Count table?  When I get this error it
> > > is because the join was incorrect - usually. Also - when the errors
> > > occur, usually there is a code and a context link that will show you
> > > more of the dump when clicked on and what the conflicting code is.  It
> > > should have also printed out the sql query at the top and you can see
> > > the exact query and troubleshoot from there.
> >
> > > On Aug 17, 6:07 am, Okalany Daniel  wrote:
> > > > the model Place hasMany Count, and Count belongs to place.
> > > > So using the Containable behaviour, i can specify conditions for
> child
> > > > fields like:
> >
> > > > $this->Place->Behaviors->attach('Containable');
> > > > $this->paginate['Place'] = array(
> > > > 'contain' => array('Count'=>array(
> > > > 'conditions'=>array('Count.date'=>date('Y-m-d'))
> > > > )),
> > > > //'order' => 'Count.count DESC'
> > > > );
> > > > $places = $this->paginate('Place');
> >
> > > > But i'd like to order the parent Model by a field in a child model.
> When
> > > i
> > > > uncomment the line that starts 'order', i get the error:
> > > > SQL Error: 1054: Unknown column 'Count.count' in 'order clause'
> >
> > > > Thanks in advance.
> >
> > > > On Tue, Aug 17, 2010 at 10:28 AM, AD7six 
> wrote:
> >
> > > > > On Aug 16, 5:25 pm, Okalany Daniel  wrote:
> > > > > > Hi, Andy Dawson,
> > > > > > i'm having a similar problem,
> >
> > > > > How similar is your sql error or code ? I find it hard to compare
> to
> > > > > things I can't see :).
> >
> > > > > > but i don't understand your fix.
> >
> > > > > I didn't get as far as to propose a fix. However I'll give you this
> > > > > hint: the book almost certainly has a relevant example and hasMany/
> > > > > hasAndBelongsToMany don't generate joins in the main query -
> hasOnes
> > > > > do.
> >
> > > > > AD
> >
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > 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+unsubscr...@googlegroups.com
> 
> > > For more options, visit this
>

Re: Easy cake pagination!

2010-08-19 Thread bradmaxs
Does your Count model have a count field and if so, how does that
relate to Place?  I am a little confused about what you are trying to
do.  Does your Count model have a place_id for the relationship
reference?

One thing you could try is in the hasMany array in the Place model you
could always declare the order there.

var $hasMany = array(
'Count' => array(
'className' => 'Count',
'foreignKey' => 'place_id',
'order' => 'Count.count ASC',
)
);







http://book.cakephp.org/view/1043/hasMany

On Aug 19, 4:42 am, Okalany Daniel  wrote:
> The SQL Query generated doesn't have a join:
>
> *Warning* (512) : *SQL Error:* 1054: Unknown
> column 'Count.count' in 'order clause'
> [*CORE\cake\libs\model\datasources\dbo_source.php*, line *673*]
> Code  | Context 
>
>             $out = null;            if ($error) {
> trigger_error('' . __('SQL
> Error:', true) . " {$this->error}", E_USER_WARNING);
>
> $sql    =       "SELECT `Place`.`id`, `Place`.`name`, `Place`.`guy_count` FROM
> `places` AS `Place`   WHERE 1 = 1   ORDER BY `Count`.`count` ASC "
> $error  =       "1054: Unknown column 'Count.count' in 'order clause'"
> $out    =       null
>
> DboSource::showQuery() -
> CORE\cake\libs\model\datasources\dbo_source.php, line 673
> DboSource::execute() - CORE\cake\libs\model\datasources\dbo_source.php, line 
> 263
> DboSource::fetchAll() -
> CORE\cake\libs\model\datasources\dbo_source.php, line 407
> DboSource::read() - CORE\cake\libs\model\datasources\dbo_source.php, line 812
> Model::find() - CORE\cake\libs\model\model.php, line 2090
> PlacesController::index() - APP\controllers\places_controller.php, line 16
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> *Query:* SELECT `Place`.`id`, `Place`.`name`, `Place`.`guy_count` FROM
> `places` AS `Place`   WHERE 1 = 1   ORDER BY `Count`.`count` ASC
>
>
>
>
>
> On Wed, Aug 18, 2010 at 8:59 PM, bradmaxs  wrote:
> > What fields do you have in the Count table?  When I get this error it
> > is because the join was incorrect - usually. Also - when the errors
> > occur, usually there is a code and a context link that will show you
> > more of the dump when clicked on and what the conflicting code is.  It
> > should have also printed out the sql query at the top and you can see
> > the exact query and troubleshoot from there.
>
> > On Aug 17, 6:07 am, Okalany Daniel  wrote:
> > > the model Place hasMany Count, and Count belongs to place.
> > > So using the Containable behaviour, i can specify conditions for child
> > > fields like:
>
> > > $this->Place->Behaviors->attach('Containable');
> > >         $this->paginate['Place'] = array(
> > >             'contain' => array('Count'=>array(
> > >                 'conditions'=>array('Count.date'=>date('Y-m-d'))
> > >             )),
> > >         //'order' => 'Count.count DESC'
> > >         );
> > >         $places = $this->paginate('Place');
>
> > > But i'd like to order the parent Model by a field in a child model. When
> > i
> > > uncomment the line that starts 'order', i get the error:
> > > SQL Error: 1054: Unknown column 'Count.count' in 'order clause'
>
> > > Thanks in advance.
>
> > > On Tue, Aug 17, 2010 at 10:28 AM, AD7six  wrote:
>
> > > > On Aug 16, 5:25 pm, Okalany Daniel  wrote:
> > > > > Hi, Andy Dawson,
> > > > > i'm having a similar problem,
>
> > > > How similar is your sql error or code ? I find it hard to compare to
> > > > things I can't see :).
>
> > > > > but i don't understand your fix.
>
> > > > I didn't get as far as to propose a fix. However I'll give you this
> > > > hint: the book almost certainly has a relevant example and hasMany/
> > > > hasAndBelongsToMany don't generate joins in the main query - hasOnes
> > > > do.
>
> > > > AD
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > 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+unsubscr...@googlegroups.com > > >  om>
> > For more options, visit this
> > group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > > --
> > > OKALANY DANIEL,
> > > P.O BOX 26150,
> > > Kampala.,
> > > Uganda.http://okasoft.net
> > > --
> > > When confronted by our worst nightmares, the choices are few; Fight or
> > > flight. We hope to find the strength to stand against our fears but
> > > sometimes, despite ourselves, we run. What if the nightmare gives chase?
> > > Where can we hide then?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 gr

Re: Easy cake pagination!

2010-08-19 Thread Okalany Daniel
The SQL Query generated doesn't have a join:

*Warning* (512) : *SQL Error:* 1054: Unknown
column 'Count.count' in 'order clause'
[*CORE\cake\libs\model\datasources\dbo_source.php*, line *673*]
Code  | Context 

$out = null;if ($error) {
trigger_error('' . __('SQL
Error:', true) . " {$this->error}", E_USER_WARNING);

$sql=   "SELECT `Place`.`id`, `Place`.`name`, `Place`.`guy_count` FROM
`places` AS `Place`   WHERE 1 = 1   ORDER BY `Count`.`count` ASC "
$error  =   "1054: Unknown column 'Count.count' in 'order clause'"
$out=   null

DboSource::showQuery() -
CORE\cake\libs\model\datasources\dbo_source.php, line 673
DboSource::execute() - CORE\cake\libs\model\datasources\dbo_source.php, line 263
DboSource::fetchAll() -
CORE\cake\libs\model\datasources\dbo_source.php, line 407
DboSource::read() - CORE\cake\libs\model\datasources\dbo_source.php, line 812
Model::find() - CORE\cake\libs\model\model.php, line 2090
PlacesController::index() - APP\controllers\places_controller.php, line 16
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

*Query:* SELECT `Place`.`id`, `Place`.`name`, `Place`.`guy_count` FROM
`places` AS `Place`   WHERE 1 = 1   ORDER BY `Count`.`count` ASC



On Wed, Aug 18, 2010 at 8:59 PM, bradmaxs  wrote:

> What fields do you have in the Count table?  When I get this error it
> is because the join was incorrect - usually. Also - when the errors
> occur, usually there is a code and a context link that will show you
> more of the dump when clicked on and what the conflicting code is.  It
> should have also printed out the sql query at the top and you can see
> the exact query and troubleshoot from there.
>
> On Aug 17, 6:07 am, Okalany Daniel  wrote:
> > the model Place hasMany Count, and Count belongs to place.
> > So using the Containable behaviour, i can specify conditions for child
> > fields like:
> >
> > $this->Place->Behaviors->attach('Containable');
> > $this->paginate['Place'] = array(
> > 'contain' => array('Count'=>array(
> > 'conditions'=>array('Count.date'=>date('Y-m-d'))
> > )),
> > //'order' => 'Count.count DESC'
> > );
> > $places = $this->paginate('Place');
> >
> > But i'd like to order the parent Model by a field in a child model. When
> i
> > uncomment the line that starts 'order', i get the error:
> > SQL Error: 1054: Unknown column 'Count.count' in 'order clause'
> >
> > Thanks in advance.
> >
> >
> >
> >
> >
> > On Tue, Aug 17, 2010 at 10:28 AM, AD7six  wrote:
> >
> > > On Aug 16, 5:25 pm, Okalany Daniel  wrote:
> > > > Hi, Andy Dawson,
> > > > i'm having a similar problem,
> >
> > > How similar is your sql error or code ? I find it hard to compare to
> > > things I can't see :).
> >
> > > > but i don't understand your fix.
> >
> > > I didn't get as far as to propose a fix. However I'll give you this
> > > hint: the book almost certainly has a relevant example and hasMany/
> > > hasAndBelongsToMany don't generate joins in the main query - hasOnes
> > > do.
> >
> > > AD
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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+unsubscr...@googlegroups.com
> For more options, visit this
> group at
> > >http://groups.google.com/group/cake-php?hl=en
> >
> > --
> > OKALANY DANIEL,
> > P.O BOX 26150,
> > Kampala.,
> > Uganda.http://okasoft.net
> > --
> > When confronted by our worst nightmares, the choices are few; Fight or
> > flight. We hope to find the strength to stand against our fears but
> > sometimes, despite ourselves, we run. What if the nightmare gives chase?
> > Where can we hide then?
>
> 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+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--
When confronted by our worst nightmares, the choices are few; Fight or
flight. We hope to find the strength to stand against our fears but
sometimes, despite ourselves, we run. What if the nightmare gives chase?
Where can we hide then?

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

Re: Easy cake pagination!

2010-08-18 Thread bradmaxs
What fields do you have in the Count table?  When I get this error it
is because the join was incorrect - usually. Also - when the errors
occur, usually there is a code and a context link that will show you
more of the dump when clicked on and what the conflicting code is.  It
should have also printed out the sql query at the top and you can see
the exact query and troubleshoot from there.

On Aug 17, 6:07 am, Okalany Daniel  wrote:
> the model Place hasMany Count, and Count belongs to place.
> So using the Containable behaviour, i can specify conditions for child
> fields like:
>
> $this->Place->Behaviors->attach('Containable');
>         $this->paginate['Place'] = array(
>             'contain' => array('Count'=>array(
>                 'conditions'=>array('Count.date'=>date('Y-m-d'))
>             )),
>         //'order' => 'Count.count DESC'
>         );
>         $places = $this->paginate('Place');
>
> But i'd like to order the parent Model by a field in a child model. When i
> uncomment the line that starts 'order', i get the error:
> SQL Error: 1054: Unknown column 'Count.count' in 'order clause'
>
> Thanks in advance.
>
>
>
>
>
> On Tue, Aug 17, 2010 at 10:28 AM, AD7six  wrote:
>
> > On Aug 16, 5:25 pm, Okalany Daniel  wrote:
> > > Hi, Andy Dawson,
> > > i'm having a similar problem,
>
> > How similar is your sql error or code ? I find it hard to compare to
> > things I can't see :).
>
> > > but i don't understand your fix.
>
> > I didn't get as far as to propose a fix. However I'll give you this
> > hint: the book almost certainly has a relevant example and hasMany/
> > hasAndBelongsToMany don't generate joins in the main query - hasOnes
> > do.
>
> > AD
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> OKALANY DANIEL,
> P.O BOX 26150,
> Kampala.,
> Uganda.http://okasoft.net
> --
> When confronted by our worst nightmares, the choices are few; Fight or
> flight. We hope to find the strength to stand against our fears but
> sometimes, despite ourselves, we run. What if the nightmare gives chase?
> Where can we hide then?

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Easy cake pagination!

2010-08-17 Thread Okalany Daniel
the model Place hasMany Count, and Count belongs to place.
So using the Containable behaviour, i can specify conditions for child
fields like:

$this->Place->Behaviors->attach('Containable');
$this->paginate['Place'] = array(
'contain' => array('Count'=>array(
'conditions'=>array('Count.date'=>date('Y-m-d'))
)),
//'order' => 'Count.count DESC'
);
$places = $this->paginate('Place');

But i'd like to order the parent Model by a field in a child model. When i
uncomment the line that starts 'order', i get the error:
SQL Error: 1054: Unknown column 'Count.count' in 'order clause'

Thanks in advance.



On Tue, Aug 17, 2010 at 10:28 AM, AD7six  wrote:

>
>
> On Aug 16, 5:25 pm, Okalany Daniel  wrote:
> > Hi, Andy Dawson,
> > i'm having a similar problem,
>
> How similar is your sql error or code ? I find it hard to compare to
> things I can't see :).
>
> > but i don't understand your fix.
>
> I didn't get as far as to propose a fix. However I'll give you this
> hint: the book almost certainly has a relevant example and hasMany/
> hasAndBelongsToMany don't generate joins in the main query - hasOnes
> do.
>
> AD
>
> 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+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--
When confronted by our worst nightmares, the choices are few; Fight or
flight. We hope to find the strength to stand against our fears but
sometimes, despite ourselves, we run. What if the nightmare gives chase?
Where can we hide then?

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Easy cake pagination!

2010-08-17 Thread bradmaxs
What is the relationship of the category and picture table?  It seems
that the pictures should possibly have a has one category and games
has many pictures.  When you look at the picture array, there is no
category reference there.  I would think there would need to be a
category_id for it to be possible. Haven't had coffee yet so go easy.

On Aug 16, 7:27 am, Abraham Boray  wrote:
> Guys I'm lost, in the middle of a project I have to separate between
> two pictures form
>    1- Pictures 4 the iPhone
>    2- Pictures 4 the Web
>
> I get this array from the controller by callin :
>         $this->Picture->recursive = 0;
>         $this->set('pictures', $this->paginate());
>
> the array is a set of pictures and the GAME (to which they belong)
> And every game have a CATEGORY
>
>  Array
> (
>     [0] => Array
>         (
>             [Picture] => Array
>                 (
>                     [id] => 1
>                     [name] => Image_15.png
>                     [type] => image/png
>                     [size] => 328004
>                     [filesize] => 320 KB
>                     [ext] => png
>                     [group] => image
>                     [path] => /files/iPhone/Image_15.png
>                     [created] => 2010-08-02 16:19:33
>                     [modified] => 2010-08-02 16:19:33
>                     [type_id] => 30
>                 )
>                 )
>
> [Game] => Array
>                 (
>                     [0] => Array
>                         (
>                             [id] => 9
>                             [game_name] => Game2
>                             [GamesPicture] => Array
>                                 (
>                                     [id] => 43
>                                     [game_id] => 9
>                                     [picture_id] => 24
>                                 )
>
>                             [Category] => Array
>                                 (
>                                     [id] => 3
>                                     [name] => web
>                                 )
>                                                 )
>                                 )
> )
>
> So wot I want is to paginate this including just the web CATEGORY
> PICTURES(Filtring)
> WHERE CATEGORY.nam='web'
>
> I tried this but it'snot working :
> /// 
> 
>  $this->set('pictures', $this->paginate('conditions' =>
> array('Category.name' => 'web')));
>
> this is the database structure so to get a clearer IDEA.
> /// 
> 
> Field   TABLE PICTURE
>         id
>         name
>         type
>         size
>         int(11)
>         filesize
>         group
>         type_id         int(11)
>
> Field   TABLE GAME
>          id
>          game_name
>          start_date
>          end_date
>          category_id
>          modified
>
>  Field  TABLE Games_pictures
>         id
>         game_id
>         picture_id
>
> Thank u  guys 4 ur future help, I'm stuck and got really to get this
> done as soon as I can Fix it
> Thank u in advance
> {A|B}

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Easy cake pagination!

2010-08-17 Thread AD7six


On Aug 16, 5:25 pm, Okalany Daniel  wrote:
> Hi, Andy Dawson,
> i'm having a similar problem,

How similar is your sql error or code ? I find it hard to compare to
things I can't see :).

> but i don't understand your fix.

I didn't get as far as to propose a fix. However I'll give you this
hint: the book almost certainly has a relevant example and hasMany/
hasAndBelongsToMany don't generate joins in the main query - hasOnes
do.

AD

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Easy cake pagination!

2010-08-16 Thread Okalany Daniel
Hi, Andy Dawson,
i'm having a similar problem, but i don't understand your fix.


On 8/16/10, AD7six  wrote:
>
>
>
> On Aug 16, 4:27 pm, Abraham Boray  wrote:
> > Guys I'm lost, in the middle of a project I have to separate between
> > two pictures form
> >1- Pictures 4 the iPhone
> >2- Pictures 4 the Web
> >
> > I get this array from the controller by callin :
> > $this->Picture->recursive = 0;
> > $this->set('pictures', $this->paginate());
> >
> > the array is a set of pictures and the GAME (to which they belong)
> > And every game have a CATEGORY
> >
> >  Array
> > (
> > [0] => Array
> > (
> > [Picture] => Array
> > (
> > [id] => 1
> > [name] => Image_15.png
> > [type] => image/png
> > [size] => 328004
> > [filesize] => 320 KB
> > [ext] => png
> > [group] => image
> > [path] => /files/iPhone/Image_15.png
> > [created] => 2010-08-02 16:19:33
> > [modified] => 2010-08-02 16:19:33
> > [type_id] => 30
> > )
> > )
> >
> > [Game] => Array
> > (
> > [0] => Array
> > (
> > [id] => 9
> > [game_name] => Game2
> > [GamesPicture] => Array
> > (
> > [id] => 43
> > [game_id] => 9
> > [picture_id] => 24
> > )
> >
> > [Category] => Array
> > (
> > [id] => 3
> > [name] => web
> > )
> > )
> > )
> > )
> >
> > So wot I want is to paginate this including just the web CATEGORY
> > PICTURES(Filtring)
> > WHERE CATEGORY.nam='web'
> >
> > I tried this but it'snot working :
> >
> ///
> 
> >  $this->set('pictures', $this->paginate('conditions' =>
> > array('Category.name' => 'web')));
> >
> > this is the database structure so to get a clearer IDEA.
> >
> ///
> 
> > Field   TABLE PICTURE
> > id
> > name
> > type
> > size
> > int(11)
> > filesize
> > group
> > type_id int(11)
> >
> > Field   TABLE GAME
> >  id
> >  game_name
> >  start_date
> >  end_date
> >  category_id
>
>
> why not use this field instead of a needless join to your unshown
> category TABLE
>
> yours with a capital word at the end of the LINE
>
> AD
>
>
> 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+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--
When confronted by our worst nightmares, the choices are few; Fight or
flight. We hope to find the strength to stand against our fears but
sometimes, despite ourselves, we run. What if the nightmare gives chase?
Where can we hide then?

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Easy cake pagination!

2010-08-16 Thread AD7six


On Aug 16, 4:27 pm, Abraham Boray  wrote:
> Guys I'm lost, in the middle of a project I have to separate between
> two pictures form
>    1- Pictures 4 the iPhone
>    2- Pictures 4 the Web
>
> I get this array from the controller by callin :
>         $this->Picture->recursive = 0;
>         $this->set('pictures', $this->paginate());
>
> the array is a set of pictures and the GAME (to which they belong)
> And every game have a CATEGORY
>
>  Array
> (
>     [0] => Array
>         (
>             [Picture] => Array
>                 (
>                     [id] => 1
>                     [name] => Image_15.png
>                     [type] => image/png
>                     [size] => 328004
>                     [filesize] => 320 KB
>                     [ext] => png
>                     [group] => image
>                     [path] => /files/iPhone/Image_15.png
>                     [created] => 2010-08-02 16:19:33
>                     [modified] => 2010-08-02 16:19:33
>                     [type_id] => 30
>                 )
>                 )
>
> [Game] => Array
>                 (
>                     [0] => Array
>                         (
>                             [id] => 9
>                             [game_name] => Game2
>                             [GamesPicture] => Array
>                                 (
>                                     [id] => 43
>                                     [game_id] => 9
>                                     [picture_id] => 24
>                                 )
>
>                             [Category] => Array
>                                 (
>                                     [id] => 3
>                                     [name] => web
>                                 )
>                                                 )
>                                 )
> )
>
> So wot I want is to paginate this including just the web CATEGORY
> PICTURES(Filtring)
> WHERE CATEGORY.nam='web'
>
> I tried this but it'snot working :
> /// 
> 
>  $this->set('pictures', $this->paginate('conditions' =>
> array('Category.name' => 'web')));
>
> this is the database structure so to get a clearer IDEA.
> /// 
> 
> Field   TABLE PICTURE
>         id
>         name
>         type
>         size
>         int(11)
>         filesize
>         group
>         type_id         int(11)
>
> Field   TABLE GAME
>          id
>          game_name
>          start_date
>          end_date
>          category_id

why not use this field instead of a needless join to your unshown
category TABLE

yours with a capital word at the end of the LINE

AD

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Easy cake pagination!

2010-08-16 Thread Abraham Boray
Guys I'm lost, in the middle of a project I have to separate between
two pictures form
   1- Pictures 4 the iPhone
   2- Pictures 4 the Web

I get this array from the controller by callin :
$this->Picture->recursive = 0;
$this->set('pictures', $this->paginate());

the array is a set of pictures and the GAME (to which they belong)
And every game have a CATEGORY


 Array
(
[0] => Array
(
[Picture] => Array
(
[id] => 1
[name] => Image_15.png
[type] => image/png
[size] => 328004
[filesize] => 320 KB
[ext] => png
[group] => image
[path] => /files/iPhone/Image_15.png
[created] => 2010-08-02 16:19:33
[modified] => 2010-08-02 16:19:33
[type_id] => 30
)
)

[Game] => Array
(
[0] => Array
(
[id] => 9
[game_name] => Game2
[GamesPicture] => Array
(
[id] => 43
[game_id] => 9
[picture_id] => 24
)

[Category] => Array
(
[id] => 3
[name] => web
)
)
)
)

So wot I want is to paginate this including just the web CATEGORY
PICTURES(Filtring)
WHERE CATEGORY.nam='web'


I tried this but it'snot working :
///
 $this->set('pictures', $this->paginate('conditions' =>
array('Category.name' => 'web')));



this is the database structure so to get a clearer IDEA.
///
Field   TABLE PICTURE
id
name
type
size
int(11)
filesize
group
type_id int(11)


Field   TABLE GAME
 id
 game_name
 start_date
 end_date
 category_id
 modified


 Field  TABLE Games_pictures
id
game_id
picture_id

Thank u  guys 4 ur future help, I'm stuck and got really to get this
done as soon as I can Fix it
Thank u in advance
{A|B}

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en