Re: data validation for optional fields

2008-12-15 Thread Markus
if i set it required into false, would that means the secondary field can be empty? how do i check something like this: if (usesecondaryemail) validate secondary_email and secondary_email is not empty can the validation for this specific fields be check from controller? On Dec 16, 12:02 

Session ID Being Reset

2008-12-15 Thread mwcbrent
I have a Cake 1.2 Build setup on my server with 3 virtual hosts pointed to it. 1) www.domainA.com 2) www.domainB.com 3) www.domainC.com All point to the same app and generate different content based in the $_SERVER['SERVER_NAME'] parameter. Everything is working great except on www.domainA.com

Re: API Documentation Question

2008-12-15 Thread mark_story
If you click on a class you should get a list of its methods and their parameters. For example, http://api.cakephp.org/class_controller.html#903188d3de83bd65c78bb676f61b3039 should take you to Controller::redirect(). And the API is generated off of the source code, so it would be very similar to

Re: $validate an array

2008-12-15 Thread gearvOsh
Perhaps do something like this if ($this->RequestHandler->isPost()) { $cleanData = array(); foreach ($this->data as $field => $data) { // Rebuild the cleanData array based on your structure for the database } $this->data = NULL; $this->data

Re: Model + foreign key problem

2008-12-15 Thread Jnic
nobody ? On Dec 14, 6:57 pm, Adriano Varoli Piazza wrote: > On 14 dic, 19:52, Jnic wrote: > > > Hi, > > > I'm doing a private message system for my website. I've created a > > database called messages, which contains : > > > id,sender_id,reciever_id,subject,message,date > > Unrelated, but do no

Activating Session ID in URL

2008-12-15 Thread Chris
Hi, I am developing a mobile site and I need to be able to use sessions without cookies. I tried to activate use_trans_sid in bootstrap.php, but the cake-session still does not put the session id in the URL. When reading the code for "CakeSession" in cake/libs/session.php, I can see that in all th

Re: Prevent redirect in Auth

2008-12-15 Thread Rob
Absolutely, it's entirely in your control when and how you redirect. Auth just protects the pages that you tell it to, and redirects you to login if that is needed. On Dec 11, 9:40 am, Dav wrote: > Hi, > > I want to use the Auth component but I don't want it to send out the > location: header.

Re: API Documentation Question

2008-12-15 Thread Rob
Your best bet is to look at the cook book, it has much easier to follow documentation. The API docs are great once you understand the basic concepts, but for the most part they aren't much better than reading the source code most of the time. http://book.cakephp.org/view/219/the-cakephp-blog-tut

Re: Why is this query returning such an odd array?

2008-12-15 Thread Rob
The array doesn't really look odd, it's doing exactly what Cake normally does and encapsulating results in an array. If I had to guess it would probably be due to the way your model is structured, and how Cake is building the SQL based on the data you are giving it. Look at the generated query (

Route user pages?

2008-12-15 Thread Mark
Basically, I want to do this Router::connect('/:username', array('controller' => 'users', 'action' => 'view'), array('username' => '[A-Za-z0-9_-]+', 'pass' => array ('username'))); But there's two problems: 1) If the user doesn't exist, it goes into a redirect loop 2) It overrides the c

Re: can't connect to oracle

2008-12-15 Thread Rob
That is telling you that there is something wrong with your connectivity to the database. Is you DB running and on the default port ? Can you validate the connection using the cake console app ? Can you connect directly with a plain PHP connect ? $db_conn = oci_connect("hr", "hr", "//127.0.0.1

Re: Bake doesn't do anything for me

2008-12-15 Thread Rob
What does your database.php look like ? On Dec 12, 1:29 pm, Lucki wrote: > No solution yet. > > My manually built models work just fine. > > table names are in ALLCAPS because it's Oracle. This doesn't stop > models from working though. > > On Dec 12, 12:36 pm, hhg wrote: > > > I see the same:

Re: URL Paths on Dedicated Server

2008-12-15 Thread acoustic_overdrive
How are you writing your CSS link? it should be like css('style') ?> not css('css/style.css') ?> On Dec 15, 12:23 am, Andreas wrote: > Hi, > I just uploaded my baked test application from a local Xampp > environment to my webserver. > > First, I have to say that mod_rewrite works fine on

Re: unobtrusive datepicker

2008-12-15 Thread Rob
First thing to check with Firebug is that all of the CSS and JS files are actually getting loaded. I had a problem with the Datepicker when I first set it up until I put the CSS in the webroot/css folder and made the modifications to the JS files that the article you mentioned talked about. Fireb

Re: Finding Auth'd users Username

2008-12-15 Thread Rob
Or you can use the trick of simply setting a variable in your app controller's beforeRender() like: if($this->Auth->user()){ $this->set('auth_user',$this->Auth->user()); } Then you have the whole Auth user collection available in your view ... On Dec 12, 12:58 am, "L

Re: Weird saveField error, UPDATE value gets ...distorted?!

2008-12-15 Thread Snoopaki
I found the error, it was on my behalf (as usual). I had a beforeSave() function in my model that replaced the $this- >model->data['file'] value with the tmp_name value of the form. I was not aware that saveField() used $this->model->data['FieldName'] to store its value. I suppose it simply runs

Re: saveAll() and HABTM

2008-12-15 Thread mark_story
Try a recent svn checkout of the 1.2 branch. It should be fixed there. -Mark On Dec 15, 3:31 pm, WebbedIT wrote: > Anyone?  I have done searching of this group and it seems there was a > bug in 1.2 that was fixed ... so I guess I'm doing something wrong but > if the array is fine using save()

Re: saveAll() and HABTM

2008-12-15 Thread WebbedIT
Anyone? I have done searching of this group and it seems there was a bug in 1.2 that was fixed ... so I guess I'm doing something wrong but if the array is fine using save() then why not work when using saveAll ()? --~--~-~--~~~---~--~~ You received this message be

Re: Weird saveField error, UPDATE value gets ...distorted?!

2008-12-15 Thread Snoopaki
I tried using cakephp's Sanitize::clean function before I call the saveField but the result is the same :/ $filename = Sanitize::clean( $filename ); The debug($filename) result is different (sanitized) of course.. debug($filename) : C:\\wamp\\www\\dev\\project\\app\\webroot\\files\\banner_

Best Practice needed: How to deal with 'hasMany' Associations in an add-View

2008-12-15 Thread volka
Hi there, I hope someone is going to share his best practice(s) with me :-) I have a model A which has a 'hasMany' association with model B. model B 'belongsTo' model A. Now when adding A's to my database I'd like to add B's at the same time and in one , as well. In A->add(), I would copy B->ad

Re: Weird saveField error, UPDATE value gets ...distorted?!

2008-12-15 Thread Snoopaki
I actually have it like this: $filename = $this->Banner- >moveUploadedFile( $this->Banner->id , $data['file']['type'] , $data ['file']['tmp_name'] ) and the function in the model class is: function moveUploadedFile( $id , $mime_type , $path ) { $extension = $this->filetypes[$mi

Re: help with find function with many associations

2008-12-15 Thread Rob
You shouldn't have any trouble doing this if you build your models correctly and choose the right conditions in your find statement in the controller. I personally tend to do this by building the SQL query that works, and then back coding the conditions into the controller (although I'm sure ther

Caching with new find methods

2008-12-15 Thread Gonza
Hi to everyone, im moving/converting all my "getFromUser()" methods from my models to: find('fromUser') because now its the new cakephp way, so well.. but the problem that i find here is that i cannot assign the caching logic to this methods, because the only things that them do is to prepare th

Re: Prepopulating forms via the URL

2008-12-15 Thread acoustic_overdrive
Hi, thanks both for your replies. @Alexandru: Unfortunately that's not flexible enough for me, because depending on where I'm coming from I may or may not want to pre- populate a field. @brian: I usually do it something like /project_images/add/project_id: 3 but that means I have to write logic

Re: Prepopulating forms via the URL

2008-12-15 Thread brian
On Mon, Dec 15, 2008 at 1:18 PM, acoustic_overdrive wrote: > > I just thought of a little function that I wanted to get some feedback > on. It's a way to pre-populate a form when adding new records, using > the URL only and no controller-specific controller logic. > > In AppController::beforeRend

Re: Prepopulating forms via the URL

2008-12-15 Thread Alexandru Ciobanu
acoustic_overdrive wrote: > I just thought of a little function that I wanted to get some feedback > on. It's a way to pre-populate a form when adding new records, using > the URL only and no controller-specific controller logic. > > In AppController::beforeRender : > > if(isset($_REQUEST['populat

Prepopulating forms via the URL

2008-12-15 Thread acoustic_overdrive
I just thought of a little function that I wanted to get some feedback on. It's a way to pre-populate a form when adding new records, using the URL only and no controller-specific controller logic. In AppController::beforeRender : if(isset($_REQUEST['populate'])) { if(empty($this->data))

Re: Weird saveField error, UPDATE value gets ...distorted?!

2008-12-15 Thread Alexandru Ciobanu
Snoopaki wrote: > The first letter of the variable $filename, in my case, as my > webserver is in C:\wamp\ , it updates the value to just 'C' > > \ escapes the rest... e.g. C:\\wamp\\ => first \ escapes the second one, so only the last one gets printed. Please paste your moveUplo

Re: Weird saveField error, UPDATE value gets ...distorted?!

2008-12-15 Thread Snoopaki
MySQL Field Type is varchar(255) in case someone is wondering ... --~--~-~--~~~---~--~~ 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 th

Re: Changing the Auth User Model

2008-12-15 Thread DavidH
Nope, this just isn't working right. Adding the before filter to the app_controller.php worked. Then I wanted to add an allow to my TwitchersController so that the add method would be available for people to add new Twitchers (users). The allow worked OK; but when I submitted the add form I got

Weird saveField error, UPDATE value gets ...distorted?!

2008-12-15 Thread Snoopaki
Hello, After performing a save() on a file form, I use the last inserted ID ( $this->Model->id ) to create a correct $filename ( my moveUploadedFile() returns the correct $filename ) and then I try to update the 'file' field via $this->Model->saveField( 'file' , $filename ). The query runs fine

HABTM sorting

2008-12-15 Thread bookroc...@gmail.com
Hi, I want to sort a column based on HABTM associations using pagination. Tables: 1) problems(id, title) 2) users(id, username) 3) problems_users(problem_id, user_id) Relation ship between problems and users table is HABTM var $hasAndBelongsToMany = array(

Re: Changing the Auth User Model

2008-12-15 Thread DavidH
Hi Putting the before filter in an app_controller controller worked OK; but it doesn't explain why it didn't work in the individual controller. Regards David On Dec 14, 10:51 pm, gearvOsh wrote: > Have you tried placing the Auth information in AppControllers > beforeFilter()? Try that and see

Re: data validation for optional fields

2008-12-15 Thread bingo
hi Markus, Within your secondary email validation criteria, set required:false $this->validate = array( 'primary_email' => 'email', 'secondary_email' => array( 'rule' => 'email', 'required' => false, 'message' => 'Please provide valid email address'

data validation for optional fields

2008-12-15 Thread Markus
hello, currently I'm creating an user input form which in it have an optional fields but that fields must be filtered too if the user give check on a checkbox, here is the example of part pf the form: use secondary email: your secondary email: what i want to do is disable the as default, whe

Auth: Why has my user no access to this action?

2008-12-15 Thread Liebermann, Anja Carolin
Hi everybody, After 2 weeks thinking about it and sleeping over it and setting up aros_acos 4 times: Please maybe somebody has a good hint what I did wrong. Situation: CakePHP 1.2 application with Auth and ACL Some permissions work fine e.g. I allow certain groups full access to a certain contr

saveAll() and HABTM

2008-12-15 Thread WebbedIT
I am working with the following models: Scheme belongsTo Organisation HABTM SchemeService Organisation hasOne Scheme SchemeServices HABTM Scheme $this->Scheme->save($this->data) saves my Scheme and SchemeServices (HABTM) no problem, but I then have to call an extra save for $this- >Schem

Re: Debugging Auth: getting the name of teh action I get kicked

2008-12-15 Thread AD7six
On Dec 15, 12:10 pm, "Liebermann, Anja Carolin" wrote: > It works: >         function beforeFilter() >     { >         parent::beforeFilter(); >                 $this->Auth->authError = sprintf(__('You are not authorized > to access that location %s .',true),$this->name.'-'.$this->params['acti

Re: custom redirect using auth component except in one specific controller

2008-12-15 Thread MrSensitive
never mind, solved it by creating an additional action in the users controller to handle custom redirects and the BeforeFilter function like this: function beforeFilter(){ if($this->name == 'confirmations'){ $this->Auth->autoRedirect = true; $this->Auth->loginRedirect = null;

AW: Debugging Auth: getting the name of teh action I get kicked

2008-12-15 Thread Liebermann, Anja Carolin
Hi, This works, too. The advantage of the other solution is, that I can leave it in for later. Thank you everybody for helping me out. Now I have "only" to find out why the person has no access. *sigh* Everybody has access to read. The action index is in the array of "read" and my user gets

AW: Debugging Auth: getting the name of teh action I get kicked

2008-12-15 Thread Liebermann, Anja Carolin
It works: function beforeFilter() { parent::beforeFilter(); $this->Auth->authError = sprintf(__('You are not authorized to access that location %s .',true),$this->name.'-'.$this->params['action']); } Gives me: "You are not authorized to access that locatio

Re: Debugging Auth: getting the name of teh action I get kicked

2008-12-15 Thread AD7six
On Dec 15, 11:58 am, "Liebermann, Anja Carolin" wrote: > Hi Daniel, > > As far as I know this works only when I am IN the action. But I wonder if I > will get there, when Auth kicks me out before. > > I will try now gearoshs idea and put it in the before filter of each action. > > Anja If it'

AW: Debugging Auth: getting the name of teh action I get kicked

2008-12-15 Thread Liebermann, Anja Carolin
Hi Daniel, As far as I know this works only when I am IN the action. But I wonder if I will get there, when Auth kicks me out before. I will try now gearoshs idea and put it in the before filter of each action. Anja -Ursprüngliche Nachricht- Von: cake-php@googlegroups.com [mailto:cake

AW: Debugging Auth: getting the name of teh action I get kicked

2008-12-15 Thread Liebermann, Anja Carolin
Hi, That looks promising, I will try that out. Anja -Ursprüngliche Nachricht- Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag von gearvOsh Gesendet: Freitag, 12. Dezember 2008 23:06 An: CakePHP Betreff: Re: Debugging Auth: getting the name of teh action I g

Re: HABTM searching

2008-12-15 Thread AD7six
On Dec 15, 10:08 am, kai wrote: > I'm trying to figure out the best way to model my HABTM search. So far > i'm building uponhttp://bakery.cakephp.org/articles/view/habtm-searching > which is a great start. Why not use the examples in the book as your start: http://book.cakephp.org/view/83/hasA

Re: Can a model belong to and habtm one model?

2008-12-15 Thread eagerterrier
Thanks Rafael and Jon, I will give it a go. TC On Dec 12, 6:37 pm, "Jon Bennett" wrote: > Hieagerterrier, > > >  I have a facebook type app that I need to build for a client (don't we > >  all?) and in it I have a model that ideally needs to be owned by one > >  user, and also habtm other use

Re: Association not producing dropdown list, help! :(

2008-12-15 Thread Alexandru Ciobanu
_Z wrote: > Now the index.ctp view: > > > > > > > > > > > > > > > > > > input('store_table_id'); > > You have an unclosed php tag there, but I guess that's a typo. Here are your op

custom redirect using auth component except in one specific controller

2008-12-15 Thread MrSensitive
Hi all, I'm having teh following problem: The application I'm writing serves three distinct user types, each having their own separated workspace. this has been implemented by a custom redirect routine that fires after a sucessful login (autoRedirect is set to false in the Auth component.) now,

Re: How Do I Define a Zero or One Relationship?

2008-12-15 Thread WebbedIT
> What I see in the scaffolded form is a textbox to enter the vendor > type. I should mention that for lookup tables, I prefer human readable > id values, so the "id" field is defined as a varchar(255). I don't > know whether that makes any difference, but it's a deviation from the > convention, s

HABTM searching

2008-12-15 Thread kai
I'm trying to figure out the best way to model my HABTM search. So far i'm building upon http://bakery.cakephp.org/articles/view/habtm-searching which is a great start. At one point we're using this to query the database for each HABTM relationship that exists: $search_model->find('all', array( '

Re: Trouble with Model associations

2008-12-15 Thread WebbedIT
You are now heading down the right track. In a relational database you create relations between directly linked tables and other tables can then inherit those relations at higher levels. You seem to have come to this conclusion yourself. By relating 'members' to 'payments', then relating 'paymen

sort a column (username) based on above HABTM associations

2008-12-15 Thread bookme
Hi, I want to sort a column based on HABTM associations using pagination. Tables: 1) problems(id, title) 2) users(id, username) 3) problems_users(problem_id, user_id) Relation ship between problems and users table is HABTM var $hasAndBelongsToMany = array( 'User' => arra

URL Paths on Dedicated Server

2008-12-15 Thread Andreas
Hi, I just uploaded my baked test application from a local Xampp environment to my webserver. First, I have to say that mod_rewrite works fine on my webserver. Anyway, now I have some problems with the correct displaying of links, css files, js scripts, etc. If I call my application via www.myu

help with find function with many associations

2008-12-15 Thread dev
Hey, I'm trying to build find function for many days with no luck, please help me guys. Models: mysql> DESCRIBE adverts; +++--+-+- ++ | Field | Type | Null | Key | Default | Extra | +