Re: Nested Models

2009-12-29 Thread Walther
You could do http://www.application.com/message/add/contract:1 using named parameters. Or setup a route for www.application.com/contract/1/message/add On Dec 28, 11:09 pm, otisjs01 wrote: > OK, so I'm asking lots of questions today...but I really want to > learn! :) > > Anyway, I'm trying to cre

Re: Count column in index view

2009-12-29 Thread Jeremy Burns
Thanks John. Option B does indeed work - sort of! It returns a list of location types with a count of their locations, but only where there is a location. In other words, it does not give me the location types that do not have have any locations. Any more ideas - anyone? On Dec 29, 12:35 pm, John

Out of office reply

2009-12-29 Thread jim
Hi, I am out the office until the 14th of January. If you require urgent assistance then please contact p...@citadelsecure.com or call him on 07890 592198 - otherwise I will answer your email on my return. Regards Jim Check out the new CakePHP Questions site http://cakeqs.org and help o

Re: Cookie in Models

2009-12-29 Thread moto
Couldn't you just use app_model.php to make the data available to all your models? On Dec 28, 2:18 am, dyutiman wrote: > Hi Nabil, > thanks for your reply and suggestion. It'll really help. > I thought about getting the cookie value in controller and pass it to > model. But for this I have to r

Re: design suggestion request

2009-12-29 Thread Lorenzo Bettini
OK, thanks. And it makes sense to test it in the test case for a controller that uses it, right? cheers Lorenzo edwingt wrote: > You have to includ it in the vendors directory and load it as > App::import > More info here http://book.cakephp.org/view/538/Loading-Vendor-Files > > On 29

Re: design suggestion request

2009-12-29 Thread edwingt
You have to includ it in the vendors directory and load it as App::import More info here http://book.cakephp.org/view/538/Loading-Vendor-Files On 29 dic, 10:53, Lorenzo Bettini wrote: > Hi > > I've just started using cakephp and I'm porting an older application. > > I need to use a bibtex parser,

Problem understanding how this model object works

2009-12-29 Thread edwingt
I have a model object called "ImpresorasProducto" that belongs to a NxM relationship table impresoras_productos. When I'm in "ImpresorasProductosController" and debug the model object it prints this: ImpresorasProducto Object ( [name] => ImpresorasProducto [belongsTo] => Array (

design suggestion request

2009-12-29 Thread Lorenzo Bettini
Hi I've just started using cakephp and I'm porting an older application. I need to use a bibtex parser, so I was wondering "where to put" such parser... in a model? in a component? what else? Or is it still good to use it as a standalone php code? In that case, how can I use it, say, inside

Re: creating absolute links (including site)

2009-12-29 Thread euromark
as i said it might work in most cases where you dont have the folders in between. but even if it works due to the virtual host pointing it is still not correct On 29 Dez., 15:42, John Andersen wrote: > Ok, I will have to try it out later! > I have Apache virtual host pointing to my applications

Out of office reply

2009-12-29 Thread jim
Hi, I am out the office until the 14th of January. If you require urgent assistance then please contact p...@citadelsecure.com or call him on 07890 592198 - otherwise I will answer your email on my return. Regards Jim Check out the new CakePHP Questions site http://cakeqs.org and help o

Re: creating absolute links (including site)

2009-12-29 Thread John Andersen
Ok, I will have to try it out later! I have Apache virtual host pointing to my applications webroot, which is why I don't see a problem, even if I change the virtual host to point to the application directory or the root directory. Thanks for the info, enjoy, John On Dec 29, 4:38 pm, euromark

Re: creating absolute links (including site)

2009-12-29 Thread Lorenzo Bettini
I've been using John's solution in many places and it seems to work correcly... John Andersen wrote: > Sorry, I just tried to move my document root away from the application > webroot, nothing was added to the url, it looks exactly like it always > do! Can you give an example of when the url will

Re: 1 controller 2 models =)

2009-12-29 Thread euromark
usually you dont need to change the $uses array! they should be linked inside the model anyway - with hasMany and belongsTo relations this way you should refer to them inside the controller: $this->Image->foo() $this->Image->Article->bar() On 29 Dez., 14:40, Renato de Freitas Freire wrote: > i

Re: creating absolute links (including site)

2009-12-29 Thread euromark
i meant "array or string" :) On 29 Dez., 13:51, John Andersen wrote: > Sorry, I just tried to move my document root away from the application > webroot, nothing was added to the url, it looks exactly like it always > do! Can you give an example of when the url will include additional > folders? >

Re: creating absolute links (including site)

2009-12-29 Thread euromark
the url may either be an array or a link well its fairly easy if you have www.domain.de/myapp/... via mod_rewrite mapped to /myapp/ webroot/ if you use $html->url() or link() you get /myapp/controller/action now - include this link in the $html->link() again, you get /myapp/ myapp/controller/act

Re: creating absolute links (including site)

2009-12-29 Thread Lorenzo Bettini
I'm using eclipse, but it doesn't seem to work on ctp files, and in most of other cases it is not able to autocomplete when using cake... euromark wrote: > and by the way > you really should use the right IDE. a good PHP Editor will make it > easy for you to look it up. > i - for example - use th

Re: Multiple Model Pagination

2009-12-29 Thread foldiman
Here's a new tutorial that's a bit more relevant http://foldifoldi.com/news/?p=466 On Dec 25, 9:15 am, foldiman wrote: > Andrew, > It sounds like you want to use a join in yourpaginationquery. If you > have set up your model relationships, the joins may happen > automagically. However, you c

Re: 1 controller 2 models =)

2009-12-29 Thread Renato de Freitas Freire
in your controller, you can set as many models as you want to use. like: var $uses = arraya('Image','Article'); to save data in each model, you can just access it like: $this->Image->save($your-data-var); $this->Article->save($your-other-data-var); if there is a way to make your article model s

1 controller 2 models =)

2009-12-29 Thread Wils
Hi Guys, How's going? so, I trying to figure out the following scenario: 2 models: - articles - images on my images table i have a column id_article. 1 view: - article + the field to upload 1 image. Problem: HOw to store the image using article_model and pass the data to images_model? tk

Re: creating absolute links (including site)

2009-12-29 Thread John Andersen
Sorry, I just tried to move my document root away from the application webroot, nothing was added to the url, it looks exactly like it always do! Can you give an example of when the url will include additional folders? In your example, what is the content of the $url variable? Enjoy, John On

Re: Count column in index view

2009-12-29 Thread John Andersen
A correction, example A gives the author with all the articles, but the article count is 1 (one) - so no luck using that! Enjoy, John [snip] Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you a

Re: Count column in index view

2009-12-29 Thread John Andersen
Hi Jeremy, I tried to play with your problem, using my own models and came up with this: Example A - gives the same issue as you have - unknown column! $results = $this->Author->find( 'all', array( 'contain' => array('Article'), 'conditions' => arra

Re: creating absolute links (including site)

2009-12-29 Thread euromark
and by the way you really should use the right IDE. a good PHP Editor will make it easy for you to look it up. i - for example - use the phpdesigner 7 which is able to include the whole core libraries if i move my mouse over the parameters of $html->link() i am able to see its parameter names + d

Re: creating absolute links (including site)

2009-12-29 Thread euromark
actually its even way easiert! $html->link($url, TRUE) does the trick the above solution from john might even be wrong in some cases (if you're not at the top level of your domain, it adds the folders to the webroot twice...) On 29 Dez., 12:00, Lorenzo Bettini wrote: > Hey thanks, that's ex

Re: Count column in index view

2009-12-29 Thread Jeremy Burns
Hi John - thanks for the reply. No luck, I'm afraid - I get the same result. I have simplified my example so I can focus in on what's not right: $results = $this->LocationType->find( 'all', array( 'recursive' => 2, 'contain' => array(

Re: creating absolute links (including site)

2009-12-29 Thread Lorenzo Bettini
Hey thanks, that's exactly what I needed! I had searched for it in the HtmlHelper but I hadn't found it since it's an inherited method :) cheers Lorenzo John Andersen wrote: > Use the html helpers url method to create the full url for the html > helpers link method, as: > > echo $html-

Re: coding practices with models

2009-12-29 Thread Martin Westin
I feel the same way sometimes. It is tempting to use model methods as $record->method() in a way similar to an object-based ORM (e.g. Rails, where class methods are used for finding and instance methods are used for record manipulation). But the way Cake works it is a bit dangerous and I would rec

Re: adding hasMany association couse find() not to work well

2009-12-29 Thread John Andersen
Hmm, I see that there are more issues - reading the last piece of your post - what are your models, because in the beginning you specify User and Copy and in the last part, you specify User and Friendship - so I am confused :) To use debug(), turn on debug in your configuration - see your /app/ co

Re: adding hasMany association couse find() not to work well

2009-12-29 Thread John Andersen
Try first just to define your hasMany relationship between the User and the Copy models as: var $hasMany = array('Copy'); Your other issue is that the condition for the find statement is not the word "condition" but "conditions" (plural) :) Enjoy, John On Dec 29, 10:55 am, Jaimon wrote:

Re: Count column in index view

2009-12-29 Thread John Andersen
Ok, I will give it a try :) The first thing I observe is that the group statement does not include all the non-grouped columns, which it should, like: 'group' => array( 'LocationType.id', 'LocationType.name', 'LocationType.parent_id', 'ParentLocationType.id', 'ParentLocationType.nam

Re: creating absolute links (including site)

2009-12-29 Thread John Andersen
Use the html helpers url method to create the full url for the html helpers link method, as: echo $html->link('TEST LINK', $html->url('/advances/forward', true)); Enjoy, John On Dec 29, 11:07 am, Lorenzo Bettini wrote: > Hi > > with the Html and Form helper it's already easy to create absolu

Re: Count column in index view

2009-12-29 Thread Jeremy Burns
Any takers for this please? On Dec 23, 6:01 am, Jeremy Burns wrote: > I have progressed a little with this, but am still struggling. I seem > to get hung up on the simplest of things with CakePHP, which is so > frustrating. I am prepared to be humiliated with an equally simple > answer to my prob

creating absolute links (including site)

2009-12-29 Thread Lorenzo Bettini
Hi with the Html and Form helper it's already easy to create absolute links (starting from the root of the site), but I'd need to create links that also include the address of the site (starting with http://). This is needed since the output of the cakephp site should also be included in other

Re: testing a controller's add action

2009-12-29 Thread Lorenzo Bettini
Thanks for all the information! Let's see how testing is in the next release, and in particular the documentation; as for proposing an alternative in the book I guess I should file a ticket, right? For the moment I'm testing controllers' actions the "hard way" :) cheers Lorenzo nurvzy

adding hasMany association couse find() not to work well

2009-12-29 Thread Jaimon
OK, i am little bit lost... i am pretty new to php, and i am trying to use cakePHP for my web- site. my db is composed of two tables: - users with user_id, name columns - copies with copy_id, copy_name, user_id (as foreign key to users) columns. and i have the matching cakePHP elements: - Us