Re: Tree reorder tweaking

2009-11-09 Thread MonkeyGirl
OK, so using $this->Category->reorder(); reorders all the children of a given category (in this example), and their children, and so on, but is there any way to reorder _all_ the categories, including the top level ones? I see now the point about my code not doing anything more than the original

Overriding a model's order when it has a different className

2009-10-29 Thread MonkeyGirl
Hi. I've got a model, Product, which has its $order variable set to 'Product.name ASC'. Usually this works fine, as you'd expect. The tricky bit is that Product hABTM itself. When it does this, it obviously needs to give the second instance of itself a different className to avoid conflicts, s

Tree reorder tweaking

2009-10-29 Thread MonkeyGirl
Hi. I'm trying to order a tree such that for any given node on the tree, all its children appear alphabetically, including the top level. If I understand the reorder() method correctly (it has sparse documentation at http://book.cakephp.org/view/229/Advanced-Usage#reorder-518 but the API at htt

Router::parseExtensions, RequestHandler and arguments

2009-09-08 Thread MonkeyGirl
Hi! I'm using Router::parseExtensions and RequestHandler to recognise extensions, which is working great. I can set up example.com/widgets/ do_stuff and also example.com/widgets/do_stuff.xml, and both work as expected. When I try passing an argument, I would have expected the URL should look li

Re: Strange contain/find issue

2009-08-18 Thread MonkeyGirl
I believe this may be the same issue I'm experiencing. After a bit of investigation, I've found out the issue is that specifying "contain" would appear to affect things in subsequent queries. For example, say I have Cart hasMany CartedProduct belongsTo Product belongsTo Brand. Product also belo

Multiple prefixes confusing the paginator

2009-07-23 Thread MonkeyGirl
Hi. I believe I've found a bug in CakePHP, but as Occam's razor means it's more likely to be something I'm personally doing wrong, I felt I should ask here first. I've set up a few prefixes in /app/config/routes.php like this: Router::Connect('/some_prefix/:controller/:action/*', array(

Re: HABTM woes (cake_1.2.0.7296-rc2)

2008-08-20 Thread MonkeyGirl
> Nope, your can not use composite keys with cakephp, you have to have > an ID (or a field that you use as the primary, auto-incrementing id) - > search the group for more background on this. Correct me if I'm wrong here, but I thought joiner tables for HABTM relationships were the exception to t

Re: HABTM woes (cake_1.2.0.7296-rc2)

2008-08-20 Thread MonkeyGirl
>         var $hasMany = 'Bid'; I could be wrong here, but I *think* that this has to be an array, even if there's only one item in it. As in: var $hasMany = array( 'Bid' => array( 'className' => 'Bid' ) ); Does updating that help at all? Zoe. --~--~-~--~~~

Re: HABTM woes (cake_1.2.0.7296-rc2)

2008-08-19 Thread MonkeyGirl
> (a) If I go to /users/add, I get the following SQL error: 1064: You > have an error in your SQL syntax; ... near 'bid_session_registrations` > AS `BidSessionRegistration`   WHERE 1 = 1' at line 1 [CORE\cake\libs > \model\datasources\dbo_source.php, line 512]. Query: SELECT > `BidSessionRegistrat

Re: many-to-many and one-to-many associations

2008-08-19 Thread MonkeyGirl
Hi. I don't necessarily know what I'm talking about, but no one else has spoken up, so here goes... The way I would get the aggregate would not be to change the finderQuery in the hasAndBelongsToMany definition. It didn't even occur to me that you could do that. Then again, maybe I'm just bein

Error pages and beforeFilter

2008-08-19 Thread MonkeyGirl
Hi. I've made an error page at /app/views/errors/error404.ctp which, as you might expect, has /app/views/layouts/default.ctp wrapped around it. The problem I've got is that the default layout relies on variables being set in /app/app_controller.php's beforeFilter(), which doesn't seem to be calle

Re: Entire site not working

2008-07-17 Thread MonkeyGirl
> Gidday, > I've done a few sites in CakePHP about 6 months ago and I'm trying to > upload one of them to a new host and it's not working. Have a look for > yourself and see if it's something you recognize - nothing is working! > This site is working flawlessly on my Windows WAMP5 server, but not

Re: Model recursion

2008-05-08 Thread MonkeyGirl
Thanks, Keymaster! It was one of those cases of not knowing what to look up in the first place. Now you've pointed me in the right direction, I'm trying just unbindModel to begin with, and if that's not a feasible solution, I'll use Bindable. Thanks again, Zoe. --~--~-~--~~---

Re: hi guys

2008-05-08 Thread MonkeyGirl
Hi! > but when i point the browser to;http://localhost/posts/ > > it shows: The requested URL /posts was not found on this server. > > any ideas what i could be doing wrong? It sounds like you have debugging set to 0 (off). If you edit app/ config/core.php, you can change it to 1 or 2 in order t

Model recursion

2008-05-08 Thread MonkeyGirl
Hi. Sorry if this is obvious, but is it possible to set recursion to only go down (to things that belong to the model in question), and not up (to things that the model belongs to)? I've got a model that I've been recursing four levels deep, which has been working fine. Now, though, I've come to

Re: Adding new records into two models with one form (or: trying to validate without saving)

2008-04-25 Thread MonkeyGirl
>    First, set the data to the model: > >    $this->ModelName->set( $this->data ); > >      $this->ModelName->set( $this->data ); > >    Then, to check if the data validates, use the validates method of the > >    model, which will return true if it validates and false if it doesn't: > >      if

Adding new records into two models with one form (or: trying to validate without saving)

2008-04-24 Thread MonkeyGirl
Hi. I'm about to try and write a bit of code that, based on data from one form, will insert some of the form's data into a record in one model, and the rest into a related record in another model. Before you point me at these threads: http://groups.google.co.uk/group/cake-php/browse_thread/threa

Re: Session ID

2008-04-23 Thread MonkeyGirl
> Can you explain why you want to do this?  For what circumstance do > they need a persistent unique value? > > The only thing I can think of is to store data on a persistent medium > - ie database or file.  And in both of these cases you can easily > generate a unique one (file / row), and just s

Re: cake 1.2 r6709 - scaffolding and german umlauts

2008-04-23 Thread MonkeyGirl
> when I create an entry in the database with the scaffolding interface, > it's possible to save german umlauts. The scaffolding webpages display > the entered characters correct, except in input fields (if try to edit > such an entry) or drop down boxes. The content is not corrupt, it's > empty.

Session ID

2008-04-22 Thread MonkeyGirl
Hi again! I'm using the session component, as documented at http://manual.cakephp.org/view/173/sessions , and it's storing and retrieving all the session variables I set just fine. However, I'm trying to find the session ID - or anything else that's unique to each visitor, but doesn't change eac

Routing with named params

2008-04-18 Thread MonkeyGirl
Hi. Just a quick routing question. Again, I'm probably missing something simple but couldn't work it out from the documentation or previous posts... I've got this route set up: Router::connect('/', array( 'controller' => 'webpages', 'action' => 'view', 'home' )); This is great as long as

Re: SIte Homepage loading very slowly

2008-04-17 Thread MonkeyGirl
One other thing to try is doing a pr() on any findAlls you're using, and see if they're recursing further than they need to. I've had pages in projects before that were practically pulling out the whole database before I realised I should specify recursion levels to be the smallest amount absolute

Re: Curious model related bug - server stops responding

2008-04-17 Thread MonkeyGirl
After a *lot* of trial and error, I've finally fixed this! What was happening was this: > App::import('Model', 'Person'); Was, through a long winded bunch of entity-relationship type associations, making CakePHP read in my Categories model. > $this->PersonTemp = new Person(); # This conflicts

Re: Routing question

2008-04-16 Thread MonkeyGirl
> I need to acces a controller action > through a subdomain. I mean, if the user browse to jose.domain.com, it needs > to be the same  as www.domail.com/profiles/view/jose(where > controller=profiles, action=view, param1=jose) I could be wrong, but I think that's not really possible. For a start,

Re: Paginate on the other model?

2008-04-16 Thread MonkeyGirl
> but how can i paginate the articles and not the categories? Try linking to /articles/index/categories:category-slug instead of / categories/view/category-slug This will go to the index function in your articles controller. Try printing out $this->params['named'] - notice how it's an array with

Re: paginate related model's data

2008-04-16 Thread MonkeyGirl
> I've just tried this on my new project, and it's great! The only > problem I've got is that the "prev" and "next" links don't include the > article:3 parameter. Is there something obvious I'm missing? After finding the previous discussions of this, I think I've fixed it by changing the followin

Re: CSS Acting Very Bizarre

2008-04-15 Thread MonkeyGirl
> now heres whats weird. I know its linking because it is getting the > background and font colors I specified but it doesn't get most other > things. Is there anywhere we can see this in action? It should be pretty easy to debug using Firefox's developer toolbar and its "inspect element" option

Re: paginate related model's data

2008-04-15 Thread MonkeyGirl
>    I think, you're missing something > (http://groups.google.com/group/cake-php/msg/60f9b49f7209d8b9 ) It's one of > the craziest thing in > automagic. Wow, you're right, I really was! So you can link to, for instance, /items/index/article:3 in order to list (paginated) all items belonging t

Re: Problems saving with hasAndBelongsToMany (multi_field)

2008-04-15 Thread MonkeyGirl
Ah, someone else has just e-mailed me with the fix, namely inserting this line: $newValues = array(); ...before line 1283 of /cake/libs/model/model.php. Phew! If either of you are ever in the UK, let me buy you both a drink. :) Thank you both very much, Zoe. --~--~-~--~~---

Re: Problems saving with hasAndBelongsToMany (multi_field)

2008-04-15 Thread MonkeyGirl
That's really odd... $this->data looks fine for my project now too... Array ( [Product] => Array ( [id] => 6 [name] => Classic Men's Parka ) [Category] => Array ( [Category] => Array ( [0] =>

Re: Problems saving with hasAndBelongsToMany (multi_field)

2008-04-15 Thread MonkeyGirl
OK, here's the complete view. I would suspect I've stumbled across a CakePHP bug to do with having multiple multi tickboxes in the same form, but I'm hesitant to draw such hasty conclusions - in the past it's always been a bug of my own. create(); if (isset($this->data[$modelName]['id'])) {

Re: Problems saving with hasAndBelongsToMany (multi_field)

2008-04-15 Thread MonkeyGirl
Thanks, that makes sense. So to get the data into a format like it is in your example, I've reverted back to how I was making the form earlier. Instead of adding multiple type elements like this: echo $form->input('Category.multi_field', array( 'options' => $categories, 'label' => 'Categories

Re: Problems saving with hasAndBelongsToMany (multi_field)

2008-04-14 Thread MonkeyGirl
OK, whatever I'm doing wrong, it's probably the exact same thing I'm doing wrong with this code (I've put it public before it's working in case it helps you help me fix my bug at all): Tarball: http://cakephp.bytenoise.co.uk/simple-blog-example.tbz SQL: http://cakephp.bytenoise.co.uk/#creating_a

Re: Problems saving with hasAndBelongsToMany (multi_field)

2008-04-14 Thread MonkeyGirl
> Oh, interesting... Yeah, I'll be happy to include it in my publicly shared code just as soon as I can get the thing working. :) > How about a full output of $this->data then? I know I have had > problems saving if the array is not in the correct order. i.e. If you > try to do $this->Product->s

Re: Problems saving with hasAndBelongsToMany (multi_field)

2008-04-14 Thread MonkeyGirl
> Hi Zoe, could you post the controller code? The thing is it's all in app_controller. I've made a scoffolding-esque set of admin pages that apply to pretty much every model. After checking the user's an admin, it works out the controller name, model name, checks if $this->data is empty, then sav

Problems saving with hasAndBelongsToMany (multi_field)

2008-04-14 Thread MonkeyGirl
Hi. I'm using this spiffy new automatically-generating-multiple-tickboxes part of the form helper like this: echo $form->input('Colour.multi_field', array( 'options' => $colours, 'label' => 'Colours', 'multiple' => 'checkbox', 'error' => array( 're

Re: paginate related model's data

2008-04-14 Thread MonkeyGirl
Yes. The easiest way is to create this page as something like /items/ view_items_of_article/article_id instead of /articles/view/article_id so that you can just use $this->paginate the way you normally would. Zoe. --~--~-~--~~~---~--~~ You received this message bec

Re: 15min Blog Tutorial

2008-04-14 Thread MonkeyGirl
A little bit of advice, for what it's worth: If you have a Unix machine with Apache on it, it can be worth trying to get your project to work locally first before trying to get it to work on someone else's server. That way you can ensure you have mod_rewrite turned on, and so on. As I point out

Curious model related bug - server stops responding

2008-04-14 Thread MonkeyGirl
Hi. Sorry to bother you all again, but I've got a curious bug I just can't fathom. In my /app/app_controller.php I've got the following code as part of a routine that works out whether the user's logged in or not: App::import('Model', 'Person'); $this->PersonTemp = new Person(); # This conflicts

Re: Buttons with the form helper

2008-03-27 Thread MonkeyGirl
> You'd have to patch HTMLHelper yourself. It currently does not have > any capability to output a button tag. To it, 'button' means an input > with type = 'button'. This should be changed, IMHO. Ah, thank you. At least I know now, thanks. Zoe. --~--~-~--~~~---~--~---

Buttons with the form helper

2008-03-27 Thread MonkeyGirl
Hi again gang! I stumbled upon a neat article about using HTML button elements, as opposed to input elements that happen to be buttons: http://particletree.com/features/rediscovering-the-button-element/ I think it'd be really neat to get the form helper to generate these. However, when I try to

Re: Suppressing UTF-8 BOM output

2008-03-24 Thread MonkeyGirl
> I had a similar problem with a symbol (I forget which, perhaps a ?) > showing up on every page. Turns out it was present in a file, I think > appController after the PHP. So I would make sure there is nothing, > whitespace included, in outside of in your included files > (app_controller.php, ap

Re: Suppressing UTF-8 BOM output

2008-03-24 Thread MonkeyGirl
> Cake isn't adding the bytes, your editor probably is. That makes sense, but if Cake's always outputting them, and other PHP scripts in /app/webroot aren't, then which file's likely to have the three bytes? I'm not up on Cake enough to know which files are always being output. I've checked the l

Re: Suppressing UTF-8 BOM output

2008-03-24 Thread MonkeyGirl
> my guess is that it is a helper or a view that is used by that page(s) > something that someone edited using a different texteditor like > homeSite Ah, but I downloaded the homepage for the site using curl and it has the same prefix, so it's not just for XLS generation - that's just the one tha

Re: Suppressing UTF-8 BOM output

2008-03-24 Thread MonkeyGirl
> I have seen this happen when one file (in my case a jpGraph file) had > a been saved with the file encoding BOM in it, when If found the file > and resaved it without it, all was good.  It actually made the jpegs > that were generated to be corrupt. Yes, I saw something along those lines mentio

Suppressing UTF-8 BOM output

2008-03-24 Thread MonkeyGirl
Hi. I'm probably missing something simple here, but a few weeks ago, my Cake app seemed to spontaneously start outputting the hex values "EF BB BF" at the beginning of all its pages. Static files such as CSS files, and non-Cake PHP files in /app/webroot, don't do this. It's just files generated w

Working out the model name of a controller

2008-02-23 Thread MonkeyGirl
Hi again! I'm discovering the joys of moving a lot of things from individual controllers to the app_controller. This means I need to be able to work out the controller name and model name for whatever happens to be inheriting it at any given time. This is how I'm doing it: $controllerName =

Inheriting attributes

2008-02-23 Thread MonkeyGirl
Hi. I'm setting up some attributes that are arrays in inherited classes. For example, in /app/app_model.php I have the $validate rules that apply to some columns which appear in every table. Similarly, in /app/ app_controller.php I have some universal $paginate settings such as the limit. Now I'

Re: Pagination with complex query (again)

2008-02-20 Thread MonkeyGirl
Thanks for the help! I've looked at the source code again, trying to understand why what you're doing is working, and it's starting to make a bit more sense to me now. Judging by this: http://api.cakephp.org/1.2/libs_2controller_2controller_8php-source.html#l00970 ...it appears that the controll

Re: Is there a good solution for this?

2008-02-10 Thread MonkeyGirl
Try something like this: $stories = $this->Story->findAll(array('complete' => 0), null, null, null, null, -1); foreach ($stories as &$story) { $comments = $this->Story->Comment->findAll(array('story_id' => $story['Story']['id']), 'content', 'created_at DESC', $story['viewablecomments'], null,

Re: Is there a good solution for this?

2008-02-09 Thread MonkeyGirl
> I want to return only a number of comments (that is defined in > "visiblecomments") in every story. This seems like an odd way of doing it, as you'd be able to specify how many comments to retrieve, but not which ones... but yes, it's certainly possible. In your story controller, if your use o

Re: user authentication example...login redirects

2008-02-09 Thread MonkeyGirl
> The 'allowEmpty' key should be assigned a boolean value. Ah, thank you. That makes sense. So I've replaced this: var $validate = array( 'name' => array( 'required' => VALID_NOT_EMPTY ) ); With this now: var $validate = array( 'name' => array( array( 'mes

Re: How to get controller name from an element view?

2008-02-08 Thread MonkeyGirl
> Hi im newbie and my English still sucks, but i want to know get the > controller name since an element view. Thanks. Try echoing out $this->params['controller'] - is that what you're after? Hope that helps, Zoe. --~--~-~--~~~---~--~~ You received this message be

Re: user authentication example...login redirects

2008-02-08 Thread MonkeyGirl
> also, in regards to the second error, make sure in your model->validate > array, that you have apostrophes around the words 'VALID_NOT_EMPTY', which > should clear out that error. Will it? I thought VALID_NOT_EMPTY *was* a constant, not a literal string. I've also heard on someone's blog that

Re: cakePHP benchmarking

2008-02-08 Thread MonkeyGirl
Hi! To be honest, rendering pages quickly is not the advantage of CakePHP. Any site you've made by hand is inherently going to be faster than one that's having to check, say, what columns are in the database's tables each time you pull something out of them. The reason it's still very much worth

Re: user authentication example...login redirects

2008-02-08 Thread MonkeyGirl
> The code i have creates my user and puts it into the database just > fine..but after that, nothing happens... no flash, no redirect. Have you made a login() function in /app/controllers/ users_controller.php? It looks like you've got the creation of new users sorted, but you now need to let the

Re: CakePHP guide

2008-02-07 Thread MonkeyGirl
> By the way, I am Japanese. I think Japanese developers want to read > documents in Japanese. So I want to translate your guide into Japanese. > Can I do that? The way I understand the hacker spirit, everybody's free to share and build upon everyone else's work, which is what makes free software

Re: CakePHP guide

2008-02-07 Thread MonkeyGirl
On Feb 6, 5:03 pm, Baz <[EMAIL PROTECTED]> wrote: > I'm never sure whether I'm doing things the "right" way. To be > honest, all this MVC stuff was brand new to me by the time I started. This > is why I've been hesitant to submit articles to the bakery, for example. > Since a lot of my stuff, can

Re: Mac OS developper setup

2008-02-05 Thread MonkeyGirl
> I created a symlink from MAMP htdocs to my dev web folder. > > I'm not sure but I think I might have a mod_rewrite issue, maybe due to > that MAMP htdocs symlink or apache default config ? There's a good chance that using a symlink instead of actually changing httpd.conf's DocumentRoot is caus

CakePHP guide

2008-02-03 Thread MonkeyGirl
Hi! Just to let you all know, I've finally written enough of the CakePHP guide that I'm working on to warrant putting it online at last. It's available here: http://cakephp.bytenoise.co.uk/ It's only the first three chapters so far, but hopefully I should have a lot more there over the next few

Re: model having association with its own

2008-01-31 Thread MonkeyGirl
> i would like to do the following. i have a table, lets call it > "softwaretype". in this table i want to store main classes (e.g. > Internet software), but also subclasses (e.g. Internet Browsers, Mail, > FTP...). i add an "parent_id" field which stores the id of the > "parent". if the type is a

Re: Order validation check and order message error

2008-01-29 Thread MonkeyGirl
> It's work but I'd like that when the first rule is not satisfied it > don't try to check the second rule. Swap the order of the two rules in the model. It checks that they're satisfied in reverse order. > Now it check first rule (if blank it set "required"), so it check > second rule and it ov

Re: Multiple rules per fields

2008-01-28 Thread MonkeyGirl
I'm no expert, but this might help: CakePHP's model validation treats later rules with a higher priority than earlier ones. This means that if neither rule is matched, it's the last rule's message that will show. I'm not sure why it works this way, but that's what seems to happen. So for example

Re: Help with Query

2008-01-28 Thread MonkeyGirl
> This should be relatively fast if your indexes are set up correctly. That's a very good point. If you haven't indexed the table, try this: ALTER TABLE login_logs ADD INDEX (created) For the benefit of anyone who hasn't discovered the joys of indexing yet, this essentially makes an alphabetise

Re: Help with Query

2008-01-28 Thread MonkeyGirl
> In my admin area I want to show the following data: > > name, created, 1st Login, Last Login Hiya! This is probably one of those rare instances where a big ol' SQL query would probably be easier than doing it at a higher level with CakePHP. Something like this in the users' model might help:

Re: Making RSS feeds with CakePHP

2008-01-28 Thread MonkeyGirl
> If you are following the example given by Nate, I think your problem might > be that you're trying to access the helpers inside the callback function, > and they are out of the scope there. > > You should truncate the data before passing it to the RSS function or see > how to pass the helper as

Re: Making RSS feeds with CakePHP

2008-01-28 Thread MonkeyGirl
Thanks for the links everyone! To answer my own first question, then: > 1. How can I tell if someone's requesting the RSS version of a page or > the regular HTML version? At the moment, I've got this in my > controller: > > if ($this->RequestHandler->__renderType == 'rss') I've replaced that w

Making RSS feeds with CakePHP

2008-01-27 Thread MonkeyGirl
Hi again! I'm trying to set up some RSS feeds using CakePHP. I'm very impressed at how easy and automated this process is, it's great! After a lot of searching, this backup of someone explaining how they did it was a great help: http://web.archive.org/web/20070601202250/jirikupiainen.com/2007/05

Re: Cake 1.2 open_basedir ERROR

2008-01-25 Thread MonkeyGirl
> Hi, > > When I update my 1.19 to 1.2 beta, I saw these below: > > "open_basedir restriction in effect" > > What's going on? Hmm... Are you using Plesk by any chance? If so, you may need to update your vhost.conf with the following: DocumentRoot /[full path to your website]/app/webroot php_adm

Re: Form field values after postback

2008-01-25 Thread MonkeyGirl
> Just noticed that this only happens if i do a : > > $form->text('test'); > > rather than: > > > > anyone know why? Usually any bug to do with just the first character of a string is a sign that the string's being treated as an array. For example, echoing out $string[0] will just return its fir

Re: enum

2008-01-25 Thread MonkeyGirl
> How would you get the enum values from the model or controller? By far the easiest way is to go to http://cakeforge.org/snippet/detail.php?type=snippet&id=112 and copy and paste the code that's there into app_model.php, then you can just use lines like the following in your code: $types = $th

Re: Business Benifit?

2008-01-24 Thread MonkeyGirl
While I agree that it's a scary place to work for that doesn't see the benefits of following standards and using frameworks, here's how I'd word it: using CakePHP lets you do make the same site in far less time (at least, it does once you're used to it, maybe for the third project onwards). It's k

Re: How do people usually learn CakePHP and what is best?

2008-01-21 Thread MonkeyGirl
> I can't be alone in > wondering what the most efficient way to get into CakePHP is. Good guides seem to be the main thing missing from CakePHP - there are plenty of tips about how to do one or two specific things at a time, but not much in the way of a beginner's guide that gives you a good ove

Re: Calling one page from another

2008-01-21 Thread MonkeyGirl
> Also, make sure that your method ends with: > return($datayouwanttoreturn); Thank you! This is what I was missing. I'm so used to CakePHP being magical that I assumed it'd to something amazing like return the $this- >set variables automatically. Now that I've ended the method being called with

Calling one page from another

2008-01-21 Thread MonkeyGirl
Hi! I'm trying to run another controller's unrelated method from within the method of the page being accessed, in the hope I might be able to get all the variables it's setting to avoid code duplication. It looks like requestAction can do this very thing, but I can't seem to get it to output anyt

Moving common methods to app_controller.php

2008-01-12 Thread MonkeyGirl
Hi again! I thought it might be a good idea to move various commonly used controller methods into app_controller.php, to handle normal CRUD duties and only be overridden for special occasions. For example, I've now replaced the following method that was in all my controllers, such as the one for

Re: Has and belongs to many, with extra columns

2007-12-13 Thread MonkeyGirl
Thank you very much, both of you. This is exactly what I was looking for! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe

Has and belongs to many, with extra columns

2007-12-11 Thread MonkeyGirl
Hi. Thanks for your help before, everyone... This one's just a quick question. I'm pretty sure the answer's "just make the new model and stop being lazy", but I'd like to make sure just in case. I've got a project with a has-and-belongs-to-many relationship, linking a products table to a feature

Re: Overriding models / pretending to delete rows

2007-09-13 Thread MonkeyGirl
Hi! Thanks for your reply. > Oh, and as a tip, all Cake find functions actually end up using > findAll - including exists, findCount, find, etc. So just change > findAll - you don't have to change each of them separately. Thank you, I'll take out the findCount() overriding bit then! Does it als

Overriding models / pretending to delete rows

2007-09-12 Thread MonkeyGirl
Hi. I'm trying to override CakePHP's deleting of rows in the database so it only looks like it's deleting them. So far I've done the following: * Updated all the tables except cake_sessions to include the column `deleted` tinyint(1) unsigned NOT NULL default '0' * Created the file app/app_mo

Re: N/A option in select (dropdown) element

2007-07-24 Thread MonkeyGirl
> function select($fieldName, $options = array(), $selected = null, > $attributes = array(), $showEmpty = '') > > Isn't that clear? :D Maybe I don't know PHP well enough, but it's not very clear to me... Would setting $showEmpty to a non-false value do the same thing as setting one of the $option

N/A option in select (dropdown) element

2007-07-24 Thread MonkeyGirl
Hi. Sorry for all these questions. If it's any consolation, I'm putting together a brief guide for making forms in CakePHP with the form helper, which is one of the reasons I want to make sure I'm doing things the right way. Anyway, my question is about how I should add the option of "none of t

Re: FormHelper checkboxes

2007-07-22 Thread MonkeyGirl
> CakePHP doesn't really support enumthis is because some of the DBs > that cakephp was made to work with do not support it. > > Instead use: tinyint(1) > > Then the cake checkboxes will work auto-magically! Ah, so the problem is that MySQL doesn't support boolean data types yet, and CakePHP

FormHelper checkboxes

2007-07-21 Thread MonkeyGirl
Hi again! I'm trying to use the FormHelper to make checkboxes for simple enum data in my database. The values in the database are always stored as 'yes' or 'no'. I can get the form to work just fine using dropdown select elements, but I can't get it to work with checkboxes. The boxes are always

Foreign keys in custom table names

2007-06-06 Thread MonkeyGirl
Please disregard my previous post. For future reference, the fix is to specify the foreign key in the model for the table that links to it, like this: class Timesheet extends AppModel { var $belongsTo = array( 'Employee' => array ('className' => 'Employee', 'foreignKey' =>

Problem overriding table names

2007-06-05 Thread MonkeyGirl
Hi. I'd really appreciate it if anyone here could help me out. I'm trying to override CakePHP's table names using useTable, which is causing it to get a bit confused when it comes to linking the tables together. I've got a table called "people" which is being used by two models, "Customer" and "