Re: Cakephp findById or find return garbage value with null id

2013-07-11 Thread Chetan Varshney
Hi, I am not able to reproduce this issue any way. Which version of Cake are you using? However you can check id is null before calling findById function. On Thu, Jul 11, 2013 at 2:40 PM, Abhay Jeet Singh wrote: > Hi, > >I am fetching the data in foreach loop by id as atta

Cakephp findById or find return garbage value with null id

2013-07-11 Thread Abhay Jeet Singh
Hi, I am fetching the data in foreach loop by id as attached file (secure_find.png). that return the garbage data for id null, although we have no record with id null. i have imported a model to another model then fetching the data. Plz suggest. Thanks in advance! -- Like Us on Face

Re: findById

2012-08-29 Thread Yasir Arafat Hasib
try this http://arafats.info/cakephp-findbyfieldname-data-read/ On Wed, Aug 29, 2012 at 4:08 PM, Nareh Tarasyan wrote : > Hey, ppl. help me. > I try this code: > > IndexsController.php > $this->set('x', $this->Word->findByid(10)); > > then > view/

Re: findById

2012-08-29 Thread Nareh Tarasyan
areh Tarasyan wrote: >> >> Hey, ppl. help me. >> I try this code: >> >> IndexsController.php >> $this->set('x', $this->Word->findByid(10)); >> >> then >> view/Indexs/index.ctp >> echo "word= ".$x; >> >&

Re: findById

2012-08-29 Thread Jeremy Burns : Class Outfit
wrote: > It would return an array. so use print_r($x); not echo. > > On Wednesday, August 29, 2012 3:38:04 PM UTC+5:30, Nareh Tarasyan wrote: > Hey, ppl. help me. > I try this code: > > IndexsController.php > $this->set('x', $this->Word->findByid(

Re: findById

2012-08-29 Thread Shiv Shankar
It would return an array. so use print_r($x); not echo. On Wednesday, August 29, 2012 3:38:04 PM UTC+5:30, Nareh Tarasyan wrote: > > Hey, ppl. help me. > I try this code: > > IndexsController.php > $this->set('x', $this->Word->findByid(10)); > > then

Re: findById

2012-08-29 Thread Dr. Tarique Sani
Try debug($x); T On Wed, Aug 29, 2012 at 3:38 PM, Nareh Tarasyan wrote: > Hey, ppl. help me. > I try this code: > > IndexsController.php > $this->set('x', $this->Word->findByid(10)); > -- ===

Re: findById

2012-08-29 Thread Shiv Modi
I think it should be $this->set('x', $this->Word->findById(10)); not $this->set('x', $this->Word->findByid(10)); Shiv On Wed, Aug 29, 2012 at 3:44 PM, AD7six wrote: > Have a look at what $x is. > > On Wednesday, 29 August 2012 12:08:04 UTC+2

Re: findById

2012-08-29 Thread AD7six
Have a look at what $x is. On Wednesday, 29 August 2012 12:08:04 UTC+2, Nareh Tarasyan wrote: > > Hey, ppl. help me. > I try this code: > > IndexsController.php > $this->set('x', $this->Word->findByid(10)); > > then > view/Indexs/index.ctp >

findById

2012-08-29 Thread Nareh Tarasyan
Hey, ppl. help me. I try this code: IndexsController.php $this->set('x', $this->Word->findByid(10)); then view/Indexs/index.ctp echo "word= ".$x; It echoes word=Array; What is the problem??? When I have loaded Word model in my IndexsController, and I have a

Re: read(null,$id) or findById($id) and limit data in associated model

2011-04-26 Thread Salines
Thanks for the instruction, it now works. On 26 tra, 23:22, cricket wrote: > On Tue, Apr 26, 2011 at 4:35 PM, Salines wrote: > > Sorry my English is not good. > > > when I call exp,www.example.com/brands/view/2 > > > Show some information about the brand and the last 9 related products > > added

Re: read(null,$id) or findById($id) and limit data in associated model

2011-04-26 Thread cricket
On Tue, Apr 26, 2011 at 4:35 PM, Salines wrote: > Sorry my English is not good. > > when I call exp, www.example.com/brands/view/2 > > Show some information about the brand and the last 9 related products > added to the database, which are active 1 (online status). > > The brand has many products,

Re: read(null,$id) or findById($id) and limit data in associated model

2011-04-26 Thread Salines
> >                        $this->Session->setFlash(__('Invalid brand', true)); > >                        $this->redirect(array('action' => 'index')); > >                } > >                // Need here some conditions, please help.. > >

Re: read(null,$id) or findById($id) and limit data in associated model

2011-04-26 Thread Taffarel de Lima
array('action' => 'index')); >} >// Need here some conditions, please help.. >$brand = $this->Brand->findById($id); >$this->set('brand',$brand ); > } > > } > &

Re: read(null,$id) or findById($id) and limit data in associated model

2011-04-26 Thread Salines
rect(array('action' => 'index')); } // Need here some conditions, please help.. $brand = $this->Brand->findById($id); $this->set('brand',$brand ); } } -- Our newest site for the commu

read(null,$id) or findById($id) and limit data in associated model

2011-04-26 Thread Salines
Y `created` DESC LIMIT 9 How can do with read() or findById() ??? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this g

Re: findById() does not work correctly after adding column to table in db

2010-08-17 Thread func0der
> > > > i just wanted to change a controller of mine and added a new column to > > > a table in the database. > > > As far as i thought "findById()" gets the whole row out of the table > > > but that isn't happening. > > > Do i have t

Re: findById() does not work correctly after adding column to table in db

2010-08-17 Thread Hashim Ikram
he /tmp/cache/models > > > Andras Kende > http://www.kende.com > > On Aug 17, 2010, at 6:32 AM, func0der wrote: > > > Hey guys, > > > > i just wanted to change a controller of mine and added a new column to > > a table in the database. > > As far as i

Re: findById() does not work correctly after adding column to table in db

2010-08-17 Thread Andras Kende
Try to clear the cache /tmp/cache/models Andras Kende http://www.kende.com On Aug 17, 2010, at 6:32 AM, func0der wrote: > Hey guys, > > i just wanted to change a controller of mine and added a new column to > a table in the database. > As far as i thought "findById()&quo

findById() does not work correctly after adding column to table in db

2010-08-17 Thread func0der
Hey guys, i just wanted to change a controller of mine and added a new column to a table in the database. As far as i thought "findById()" gets the whole row out of the table but that isn't happening. Do i have to change anything in my controller, clear the cache or anything e

Re: model findById reads no data

2010-04-27 Thread cwsTrummer
hey thanks for your reply. but i found the error. it was another one. i forgot echo $form->input('id', array('type'=>'hidden')); in my view. so everytime a new page was generated! i do always use $this->show($id); $this->render("show"); after edit and it works fine! i am using cake for 3 years n

Re: model findById reads no data

2010-04-27 Thread John Andersen
everything is fine i get an array with > $data['Page'] and $data['Document']; > > function show($id) >         { >                 $data = $this->Page->findById($id); >                 $this->set("data", $data); >         } > > wh

model findById reads no data

2010-04-27 Thread cwsTrummer
; function show($id) { $data = $this->Page->findById($id); $this->set("data", $data); } when i call edit function everything works fine too. but after i call $this->Page->save($this->data) i want to go back to show function. $this->Sessi

Re: Question of Performance read () or findById

2010-02-27 Thread WebRenovator
I guess its just habit or personal preference. I tend to use read, just to make sure that joins are never returned (though i also tend to set recursive=-1 in my app_model so that problem never actually happens). I use find for more complex queries. On Feb 26, 11:16 am, WebbedIT wrote: > I always

Re: Question of Performance read () or findById

2010-02-26 Thread WebbedIT
I always use find, not for any particular reason other than I am then using a consistent command across my site with a consistent way to pass in my variables to control the results I get. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questio

Re: Question of Performance read () or findById

2010-02-25 Thread amarradi
; in the view of the performance. > > > The first way i use was this. > > > >  $entry = $this->WishlistEntry->read(null, $this->data['WishlistEntry'] > > > ['wishlist_entry_id']); > > > in the next step of my programming evolution

Re: Question of Performance read () or findById

2010-02-25 Thread amarradi
; in the view of the performance. > > > The first way i use was this. > > > >  $entry = $this->WishlistEntry->read(null, $this->data['WishlistEntry'] > > > ['wishlist_entry_id']); > > > in the next step of my programming evolution

Re: Question of Performance read () or findById

2010-02-25 Thread amarradi
try'] > > ['wishlist_entry_id']); > > in the next step of my programming evolution i found findById. > > >  $entry = $this->MyModel->findById($this->data['MyModel'] > > ['entry_id']); > > > What are the difference betwee

Re: Question of Performance read () or findById

2010-02-25 Thread Dr. Loboto
WishlistEntry->read(null, $this->data['WishlistEntry'] > ['wishlist_entry_id']); > in the next step of my programming evolution i found findById. > >  $entry = $this->MyModel->findById($this->data['MyModel'] > ['entry_id']); >

Re: Question of Performance read () or findById

2010-02-25 Thread Lucca Mordente
as this. > >  $entry = $this->WishlistEntry->read(null, $this->data['WishlistEntry'] > ['wishlist_entry_id']); > in the next step of my programming evolution i found findById. > >  $entry = $this->MyModel->findById($this->data['MyModel']

Question of Performance read () or findById

2010-02-25 Thread amarradi
programming evolution i found findById. $entry = $this->MyModel->findById($this->data['MyModel'] ['entry_id']); What are the difference between this tow lines of code. Which is better for the performance many greetings marcus radisch Check out the new CakePHP Questions

Re: About the findById method and it's returns

2008-07-17 Thread iWorm
It works! Thanks very much. On Jul 17, 1:45 am, mark_story <[EMAIL PROTECTED]> wrote: > Try setting $this->Order->recursive = 2 before doing the find.  Since > order doesn't directly relate to Shop it doesn't come up in the find > results with default settings. > > -Mark > > On Jul 16, 5:42 am, i

About the findById method and it's returns

2008-07-17 Thread iWorm
I've posted this yesterday, but I can't find it, so I post it again. --- Hi, I have 4 tables. people id name foods id name shopid shops id name orders id peopleid foodid In

Re: About the findById method and it's returns

2008-07-16 Thread mark_story
Try setting $this->Order->recursive = 2 before doing the find. Since order doesn't directly relate to Shop it doesn't come up in the find results with default settings. -Mark On Jul 16, 5:42 am, iWorm <[EMAIL PROTECTED]> wrote: --~--~-~--~~~---~--~~ You received

About the findById method and it's returns

2008-07-16 Thread iWorm
Hi, I have 4 tables. people id name foods id name shopid shops id name orders id peopleid foodid In my application, 1 order has 1 food, 1 shop has many foods, 1 people has many orders Models: //People var $hasMany = array( 'Order' => array(

Re: How to use findById from a different model in a model

2007-09-16 Thread AD7six
On Sep 15, 10:12 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > You can't use $this-> inside another model. At the risk of starting a pie fight, the above isn't true. If your associations are setup such that from a controller you are able to do: $this->

Re: How to use findById from a different model in a model

2007-09-16 Thread Anupom
Hi Charlie, What Tarique is talking about is low/loose/weak coupling. Coupling is the degree of dependency between modules. Low coupling refers to a relationship in which one module interacts with another module through a stable interface and does not need to be concerned with the other module's

Re: How to use findById from a different model in a model

2007-09-16 Thread Charlie van de Kerkhof
Thnx Tarique, I get your point. I agree but for now it has to be like this. Thnx anyway On Sep 16, 10:43 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote: > On 9/16/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote: > > > > > You got my attention. Why is this? Is this because of performance

Re: How to use findById from a different model in a model

2007-09-16 Thread Dr. Tarique Sani
On 9/16/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote: > > You got my attention. Why is this? Is this because of performance > issues? What do you mean by 'loose coupling'? > http://en.wikipedia.org/wiki/Loose_coupling Loosely coupled models are desirable amongst other things because they

Re: How to use findById from a different model in a model

2007-09-15 Thread Charlie van de Kerkhof
> > > On 9/15/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote: > > > // In model Ticker: > > > $artists = $this->Artist->findById(12); > > > > is not working because the model Artist is not known (?) in model > > > Ticker. Even with the

Re: How to use findById from a different model in a model

2007-09-15 Thread Dr. Tarique Sani
On 9/16/07, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > On 9/15/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote: > > // In model Ticker: > > $artists = $this->Artist->findById(12); > > > > is not working because the model Artist is not known

Re: How to use findById from a different model in a model

2007-09-15 Thread Chris Hartjes
On 9/15/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote: > // In model Ticker: > $artists = $this->Artist->findById(12); > > is not working because the model Artist is not known (?) in model > Ticker. Even with the loadModel('Artist') is is not working. &

Re: How to use findById from a different model in a model

2007-09-15 Thread Charlie van de Kerkhof
el Ticker: > > $artists = $this->Artist->findById(12); > > > is not working because the model Artist is not known (?) in model > > Ticker. Even with the loadModel('Artist') is is not working. > > > Anyone any idea? > > thnx in advance > > You can&#

Re: How to use findById from a different model in a model

2007-09-15 Thread Charlie van de Kerkhof
ot;Marcelo Linhares" <[EMAIL PROTECTED]> wrote: > $uses = array("Artist","Ticker"); > > []s > Marcelo Linhares > > 2007/9/15, Charlie van de Kerkhof <[EMAIL PROTECTED]>: > > > > > > > Hi, > > > I like to use the mode

Re: How to use findById from a different model in a model

2007-09-15 Thread Marcelo Linhares
$uses = array("Artist","Ticker"); []s Marcelo Linhares 2007/9/15, Charlie van de Kerkhof <[EMAIL PROTECTED]>: > > Hi, > > I like to use the model standard functions like findById() in another > model instead of a controller. > In model Ticker I want

How to use findById from a different model in a model

2007-09-15 Thread Charlie van de Kerkhof
Hi, I like to use the model standard functions like findById() in another model instead of a controller. In model Ticker I want data from a table called 'artists' which has model 'Artist' but model Ticker doesn't use a database table. // In model Ticker: $artists = $

Re: how to deal with $this->User->findById('3')['User']['name']

2007-04-07 Thread GreyCells
t;field(); ~GreyCells On Apr 7, 8:33 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > when code in cake,I always encounter the situation $this->User- > > >findById('3')['User']['name'] ,something like that. > > but it doe

Re: how to deal with $this->User->findById('3')['User']['name']

2007-04-07 Thread Seb
efined! (req: '".implode('.',$member)."')",E_USER_NOTICE); break; } } return $data; } [/code] You'll be able to do something like this; $foo = $this->get($this->Us

how to deal with $this->User->findById('3')['User']['name']

2007-04-07 Thread [EMAIL PROTECTED]
when code in cake,I always encounter the situation $this->User- >findById('3')['User']['name'] ,something like that. but it doesn't work.I know.I used to coding like this :$foo = $this- >User->findById('3'); $foo['User']['n