Re: Any chance to get the ID of a new created record BEFORE I save it to the DB?

2009-12-02 Thread Quess
@Miles J Your idea won't work with mysql and id field as autoincrement (dunno how with other db but i assume that can be the same). If you have 100 rows with id from 1 to 100 and you will delete last 5 (from 96 to 100), then doing insert new rown you will get id 101, not 96. @DigitalDude Please ta

Re: TreeBehavior fails to set lft and rght correctly

2009-12-02 Thread Dave
That was what the comment suggested and I was suggesting you try their suggestion =) I wish I could help more, as I said, I didn't need to specify anything different then what you are using, but I am also using the latest svn checkout. I thought perhaps the comment was regarding an older version

Re: Complex Relationships

2009-12-02 Thread John Andersen
Ok :) Using your terms, the following may be defined: Owner hasMany Location, Location belongsTo Owner Location hasMany Room, Room belongsTo Location Category hasMany Room, Room belongsTo Category Room hasMany Booking, Booking belongsTo Room Renter hasMany Booking, Booking belongsTo Renter Where:

Re: $this->User->modelA->save doesn't key modelA properly

2009-12-02 Thread John Andersen
In your ModelA controller, you have to add the users id manually before invoking the ModelA save. If you are using Auth, then get the users id from $this->Auth->user ('id') /* From my memory */ and add it to the data array before invoking ModelA. By using $this->User->ModelA does not automatically

Re: Here is my database schema,please peovide me model for his.

2009-12-02 Thread anand angadi
Hi john, Thanks a lot for your valuable result...will do accordingly... Cheers: Anand On Thu, Dec 3, 2009 at 11:52 AM, John Andersen wrote: > Sorry to say Anand, but your schema does not conform to what CakePHP > expects, which makes it difficult to make it work with CakePHP, > without specifyi

Re: Here is my database schema,please peovide me model for his.

2009-12-02 Thread John Andersen
Sorry to say Anand, but your schema does not conform to what CakePHP expects, which makes it difficult to make it work with CakePHP, without specifying a lot of information. Suggest you rethink your schema, so that: 1) It conforms to CakePHP (table names plural, foreign keys equal foreign key tabl

Re: Help accessing array from HABTM relationship

2009-12-02 Thread Jeremy Burns
I have spread your array out so I can see its layout. I *think* you'd need to do a foreach loop on users too. On Dec 3, 12:02 am, Casmit wrote: > I have a table called Group that has a HABTM relationship to table > Points.  Group also has a HABTM relationship to Users.  Groups_Points > table mana

Re: How to get two input fields in same line?

2009-12-02 Thread Jeremy Burns
You could also do this: input('User.name', array('div' => false));?> You could do your own surrounding div, then two inputs with div => false; in other words, take case of the divs yourself. On Dec 3, 5:46 am, anand angadi wrote: > Hi, > This may help you... > > class="content"> >   >     Us

Re: How to get two input fields in same line?

2009-12-02 Thread anand angadi
Hi, This may help you... UserName :   input('username',array('label'=>false)); ?> Password :   input('password',array('label'=>false)); ?> Cheers: Anand On Thu, Dec 3, 2009 at 11:05 AM, cake wrote: > Hi all > > How can I get two input fields in same line in cakephp? > By

Re: Here is my database schema,please peovide me model for his.

2009-12-02 Thread anand angadi
Hi john, No... here is table script attached... please take a look at it...u wil get an idea... Cheers: Anand On Wed, Dec 2, 2009 at 4:46 PM, John Andersen wrote: > Looks confusing, sorry :) > > Trying to transform your tables into a workable ER model (not CakePHP > model): > > A user may hav

Re: How to get two input fields in same line?

2009-12-02 Thread Amit Rawat
can u show me the code for both line 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@googlegr

How to get two input fields in same line?

2009-12-02 Thread cake
Hi all How can I get two input fields in same line in cakephp? By default each input field are coming in seperate line. How can we put a space and bring it in same line. Please help.. Thanking You Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP rela

Re: commands out of sync error

2009-12-02 Thread mahesh babu
Thaq for ur response. i have called stored procedure from business layer(fnction name execute()) like this $sql = "CALL sp_viewAllDivisions('".$_SESSION[organisationSID]."');"; The stored procedure like this: CREATE definer=`ro...@`localhost` PROCEDURE `sp_viewAllDivisions`(org_id i

$this->User->modelA->save doesn't key modelA properly

2009-12-02 Thread Christian
User has many ModelA So in the ModelA Controller, I replaced every $this->ModelA with $this- >User->ModelA so every action done is user specific. The index action successfully shows only that users ModelA's, however the add() action creates ModelA with user_id = 0 everytime. If this is the intende

Re: Populating field from session variables

2009-12-02 Thread Saliem
correction echo $form->input('name', $options = array('value' => $data ['name'])); On Dec 2, 7:39 pm, Saliem wrote: > at some point you must save the posted data to the session variable > and set the variable for use in the view template. > > once you do that do > > echo $form->input('name', $o

Re: Populating field from session variables

2009-12-02 Thread Saliem
sorry correction : echo $form->input('name', $options = array('value' => $data ['name'])); On Dec 2, 7:39 pm, Saliem wrote: > at some point you must save the posted data to the session variable > and set the variable for use in the view template. > > once you do that do > > echo $form->input('na

Re: Populating field from session variables

2009-12-02 Thread Saliem
at some point you must save the posted data to the session variable and set the variable for use in the view template. once you do that do echo $form->input('name', $options = array('value' = $data['name'])); in the view template and where $data is a variable that contains the data from the sess

HABTM questions

2009-12-02 Thread Alan Asher
I've been scouring the web for a while trying to figure this out. My brain is fried, so I need some help. I have a model called Containers, a model called Assets and HABTM table called AssetsContainer. So a container can have many assets. The first question I have is when I'm doing thi

Re: How can I get the current session?

2009-12-02 Thread nurvzy
Hi Mario, I've repackaged my little who's online utility as a plugin. It works well enough for my purposes basing off IP, its easy to track test and get at easily. /shrug If you're interested, I wrote about it: http://www.webtechnick.com/blogs/view/227/CakePHP_Who_s_Online_Plugin You can dig

Re: commands out of sync error

2009-12-02 Thread Marcelo Andrade
On Wed, Dec 2, 2009 at 4:44 AM, mahesh babu wrote: > hi, > I have attatched  screenshot regarding my error.Here i am used flex with > php. > plz help me Give us some information context to help you. I program PHP in Linux, barely used Flex, don't know nothing about your SQL query neither it was

Re: trying to Implement ajax stream of new blog post every 5 seconds

2009-12-02 Thread Marcelo Andrade
On Tue, Dec 1, 2009 at 2:58 AM, Casmit wrote: > I'm trying to implement a feature on our website where the page > displays the latest 10 blog post through an ajax stream.  Every 5 > seconds, new post appear in the list and the older post fall off.. > > Any links/info on how this can be done? You

Re: Containable query

2009-12-02 Thread Bryan Paddock
Hmm... nobody have any ideas? On Tue, Nov 24, 2009 at 4:05 PM, Bryan Paddock wrote: > Hey all, > > I have this relationship in question: > > User -> hasOne Student -> hasMany Submission > > I'm a bit stumped on how I can fetch all the users who do not have any > submissions linked to their name.

Re: TreeBehavior fails to set lft and rght correctly

2009-12-02 Thread Martin Kirchgessner
Top of the model is : class MenuItem extends AppModel { var $name = 'MenuItem'; var $actsAs = array('Tree', 'Containable'); the table : CREATE TABLE `menu_items` ( `id` int(11) NOT NULL auto_increment, `parent_id` int(11) default NULL, `lft` int(11) default NULL, `rght

Re: How can I get the current session?

2009-12-02 Thread Dave
Ps. I think that previous statement that Session is a client side object is incorrect. Sessions = server side, Cookies = client side If I am not mistaken... which happens plenty heh On Wed, Dec 2, 2009 at 7:11 PM, Dave wrote: > You can use the session id as the key as well if you prefer > > Y

Re: How can I get the current session?

2009-12-02 Thread Dave
You can use the session id as the key as well if you prefer You just need to be sure to change the Security.level value in your core.php to at most medium. On high it regenerates the session id every request. On Wed, Dec 2, 2009 at 1:08 PM, Mario wrote: > Hi Nick, > > thank you for your reply,

Re: inventory management

2009-12-02 Thread Dave
I have to agree at least if you store in metrics you will ever only have to convert it once, when you are displaying it. Though this inherently loses some accuracy, it is exponentially worse if you have to convert a conversion On Wed, Dec 2, 2009 at 1:45 PM, fly2279 wrote: > I agree that metric

Help accessing array from HABTM relationship

2009-12-02 Thread Casmit
I have a table called Group that has a HABTM relationship to table Points. Group also has a HABTM relationship to Users. Groups_Points table manages this relationship. I can run a $this>Point>Group>findAll command and get an array that looks like this: Array ( [0] => Array ( [Group] => Array (

Re: TreeBehavior fails to set lft and rght correctly

2009-12-02 Thread Dave
Also, these two suggestions were in the comments. I didn't need the relationship from the first one but I am using the latest svn checkout, so perhaps he was posting that from an older version. Also the second one might be useful as well. The model needs a relation for me to work with this exam

Re: TreeBehavior fails to set lft and rght correctly

2009-12-02 Thread Dave
Can you paste your model? Or at least the important parts at the top? On Wed, Dec 2, 2009 at 6:19 PM, Martin Kirchgessner wrote: > Hi everyone, > > I'm using TreeBehavior in a classic model, but its lft and rght fields > are not set correctly. > > > I tried these two save() in a controller : >

Re: Any chance to get the ID of a new created record BEFORE I save it to the DB?

2009-12-02 Thread Miles J
Its impossible to get the ID for a row your about to save, until after you save it. The most you can do is do a query to select the last row in the table, then increment its ID by one. On Dec 2, 2:18 pm, Dave wrote: > I think this would really help your situation > > http://bakery.cakephp.org/ar

TreeBehavior fails to set lft and rght correctly

2009-12-02 Thread Martin Kirchgessner
Hi everyone, I'm using TreeBehavior in a classic model, but its lft and rght fields are not set correctly. I tried these two save() in a controller : $this->MenuItem->create(); $this->MenuItem->save(array('MenuItem' => array( 'url' => '/f

Re: Any chance to get the ID of a new created record BEFORE I save it to the DB?

2009-12-02 Thread Dave
I think this would really help your situation http://bakery.cakephp.org/articles/view/wizard-component-1-2-1 I have used it in the past and if you read the documentation thoroughly it is very easy to implement. On Wed, Dec 2, 2009 at 1:05 PM, DigitalDude wrote: > Hey, > > I have a serious probl

Re: Complex Relationships

2009-12-02 Thread onlymejosh
These are the objects Renter, Owner, Room, Booking The number of guests isn't a factor. The booking invovles one room at a time. Its not a normal hotel per- say On Dec 2, 5:18 pm, John Andersen wrote: > I see the following objects in your description: > Renter, Guest, Room, Owner, Booking > > C

footer appears twice-problem

2009-12-02 Thread Paulos23
Hello people, i have build my app and i have a problem.I have created a footer which i included in every layout that i use.All seems good in all layouts apart from my home page.I saw the code from Firebug and i realize that the footer and the header as well appear 2 times.I imagine that this is cau

Re: modifying baked sources

2009-12-02 Thread Jeremy Burns
I guess there are two approaches. 1. Rename the model/views/ controllers before you bake, then do a comparison and merge afterwards. 2. Once you have the initial bake complete, just amend the files rather than re-baking. This has the advantage of helping you learn as well. On Dec 2, 6:23 pm, Loren

Re: inventory management

2009-12-02 Thread fly2279
I agree that metric would be much easier to convert but therein lies the problem. Every time you convert from the user input of imperial to metric you lose some accuracy in the total inventory. I guess I just need to use the smallest unit to store it in the table and then convert when inventory is

Re: inventory management

2009-12-02 Thread mike karthauser
I suggest using a metric measure for your volumes which as base 10 will be easier to work with than the different scales between oz pints and gallons. You can then convert your metric measure to an imperial amount via a helper. What ever way you do it you'll need to maintain the same unit o

Re: Are unit tests REALLY a unit tests?

2009-12-02 Thread mark_story
Although you don't use all the relations, all of the fixtures are needed due to the way associations are implemented by CakePHP. This is mostly a side effect of PHP4 support and will be removed once autoloading of models can be achieved. -Mark On Dec 1, 9:00 am, Grzegorz Pawlik wrote: > Those s

Re: What to use (Component? Helper?) for methods used in both controller and view

2009-12-02 Thread mark_story
Another approach is to do neither. You can create classes that are not direct MVC bits and use them. Like jonas said the core Inflector and Set classes are excellent examples of non MVC utility classes. -Mark On Dec 2, 6:40 am, "j0n4s.h4rtm...@googlemail.com" wrote: > a.) Write both, Component

modifying baked sources

2009-12-02 Thread Lorenzo Bettini
Hi If I create models, controllers and views with bake, and I modify those files, the next time I run bake they'll overwritten (say that I added some new fields that I "want to bake"); is there a general idiom to deal with that? thanks in advance Lorenzo P.S. is bake documented in mor

Re: How can I get the current session?

2009-12-02 Thread Mario
Hi Nick, thank you for your reply, very interesting suggestion for the who's online feature. And yes, once I get hold of who is browsing, I want to store the data in a table (may be 'users' with a status flag indicating they are not registered). But why rely on $_SERVER['REMOTE_ADDR'] (IPs aren'

Re: How can I get the current session?

2009-12-02 Thread Mario
Hi Nick, thank you for your reply, very interesting suggestion for the who's online feature. And yes, once I get hold of who is browsing, I want to store the data in a table (may be 'users' with a status flag indicating they are not registered). But why rely on $_SERVER['REMOTE_ADDR'] (IPs aren'

Any chance to get the ID of a new created record BEFORE I save it to the DB?

2009-12-02 Thread DigitalDude
Hey, I have a serious problem, and I need a hint from you guys to solve it! In one of my controller actions, I have the problem that I need to create some records , let's say A, B, and C. The problem is, that record A needs a field from record B, which is the ID of record B, and which I only can

inventory management

2009-12-02 Thread fly2279
I need guidance on how to setup an inventory system. The inventory I am managing is in liquid form and will be added/subtracted in different units. For example Product A will be added from the supplier in gallons, distributed out the door in pints, and applied in fluid ounces. I thought about havin

Re: Error in the manual?

2009-12-02 Thread Miles J
Well of course you cant use a helper in a controller. Helpers are used in views ONLY. You define it in the controller, which in turn passes it down to the views. On Dec 1, 9:18 am, drbuzasi wrote: > This page (http://book.cakephp.org/view/53/components-helpers-and- > uses) begins with the followi

Re: Complex Relationships

2009-12-02 Thread John Andersen
I see the following objects in your description: Renter, Guest, Room, Owner, Booking Can one room have more than one Guest per room? Can one booking involve more than one room? John On Dec 2, 5:42 pm, onlymejosh wrote: > Hi, > > I need some guidance on how to build these model relationships.

Re: beforeSave vs beforeValidate

2009-12-02 Thread j0n4s.h4rtm...@googlemail.com
Check what those methods have to return, at least(maybe both) one of them (I "think" it was beforeSave) has to return true; On Dec 1, 10:46 pm, naidim wrote: > Sorry, I meant to say the code is in the user MODEL not controller. Check out the new CakePHP Questions site http://cakeqs.org and help

Re: Security component woes

2009-12-02 Thread j0n4s.h4rtm...@googlemail.com
Dump our beforeFilter (AppController and UsersController) On Dec 1, 6:20 pm, "designv...@gmail.com" wrote: > Hi all, > > I have the Security component enabled in my users controller and its > adding the tokens into my register form and I am viewing it via HTTPS, > however the form never submits,

Re: releted select

2009-12-02 Thread j0n4s.h4rtm...@googlemail.com
With Model->recursive you can just use associations and fetch data. See http://book.cakephp.org/view/82/hasMany in your ClientsController just do $this->set('clients', $this->Client- >find('first', array('conditions' => array('Client.id' => $id; In your clients/view.ctp debug($clients); On Dec

Re: Delete confirm

2009-12-02 Thread j0n4s.h4rtm...@googlemail.com
A mostly working solution[1][2], that you can see here: http://github.com/ionas/sna/blob/master/www/app/app_controller.php#L11 http://github.com/ionas/sna/blob/master/www/app/app_error.php http://github.com/ionas/sna/blob/master/www/app/views/errors/possible_csrf_attack.ctp http://github.com/ionas/

What is the proper place to alter $_findMethods? (CakePHP 1.3alpha)

2009-12-02 Thread Alfred Pakenham
Hi, I'm creating a custom find method in my AppModel: _findRandom. And I want it to be accessible to all models, as I understand, for this to be achieved I need "random" (as a string) to be present in a $_findMethods array. It is set in Model class, and I thought that I can append to it in beforeFi

Polivoda Dynamic Menu and other menu htmlentities issues

2009-12-02 Thread babilasaronni.it
Thanks a loot for this kind of menu. http://www.palivoda.eu/2008/04/dynamic-menu-in-cakephp and for the service, it helped me to improve my software solution based on cake. In order to validate (w3c) my pages I have encountered a small problem with ampersant (&) and in particoular the code in th

Re: CakeFest IV - America - Help us pick a location!

2009-12-02 Thread snowdem
I vote for New York or San Francisco...or Austin, TX. On Nov 19, 2:23 pm, Lance Willett wrote: > I vote for West Coast first, Central second. > > West: Denver, Phoenix, San Diego, Austin, and Bay Area are top > choices. Easy to fly to, mostly good weather. ;) > Central: Chicago would be my vote f

Self Join Problem

2009-12-02 Thread soleil83
Hi All, I' ve got a problem with my self-join association. My model looks like this: array( 'className' => 'Assembly', 'foreignKey' => 'assembly_id' ), 'Linker' => array( 'className' => 'Link

Re: Populating field from session variables

2009-12-02 Thread LazyCoder
1. User fills the form. When the user clicks next button, form fields are saved to the session variable. // Save to session $this->Session->write('mydata', this->data); 2. User is displayed with the data he entered before to confirm. 3. If the data is incorrect (Recall controller) something l

Newbie question

2009-12-02 Thread Dave
I apologize if my questions is obvious or has been answered before. I tried searching for the answer, but I don't know what best to search for, mostly likely because I am barely sure of what the terms are for the issue I am facing. I am *very* new to Cake, but I am picking it up pretty quickly. I

Re: alphaNumeric not allowing valid entry (1.2.5)

2009-12-02 Thread frcole
Yeah, Im having exactly the same problem with PHP 5.2.9 and CakePHP 1.2.5. Ive triple checked no punc or white space. Still refusing to accept the input. On Nov 23, 4:51 am, timstermatic wrote: > Hi All, > > I have PHP 5.1.6 with CakePHP 1.2.5 and I am having problems with > validating user en

Complex Relationships

2009-12-02 Thread onlymejosh
Hi, I need some guidance on how to build these model relationships. I need to build something that allows people to book a room in an accommodation. These are the steps. User finds room. User requests to stay in room Owner accepts / declines User Pays / finds another room. I have 3 tables so fa

Re: What to use (Component? Helper?) for methods used in both controller and view

2009-12-02 Thread j0n4s.h4rtm...@googlemail.com
a.) Write both, Component and Helper, try to wrap Component methods from your helper. b.) Look at the Set:: or Inflector:: class, what they extend, where they are in core cake, how they get loaded while a cake app runs - implement it similar! c.) Whatever you do, most likely (there are exceptions,

Re: Here is my database schema,please peovide me model for his.

2009-12-02 Thread John Andersen
Looks confusing, sorry :) Trying to transform your tables into a workable ER model (not CakePHP model): A user may have one or more phone numbers A user may have one or more addresses Each phone number belongs to one user Each address belongs to one user An address may have one or more details A

Re: What to use (Component? Helper?) for methods used in both controller and view

2009-12-02 Thread euromark
i usually put them into components as components can easily be added in helpers/views as well with App::import() otherwise around it usually aint that clean (html markup etc in the helper?) so better this way a) you dont have bootstrap functions you only need once or twice b) you dont have redun

Re: Html entities

2009-12-02 Thread Ernesto
i solved the problem. the culprit was the Sanitize class On 2 Dic, 11:49, euromark wrote: > if you used utf8 correctly, it would not do that... > > On 2 Dez., 08:55, Ernesto wrote: > > > > > Hello. > > > i have a controller, a model and the usual add/remove/edit views > > > in the add view i ha

Re: Html entities

2009-12-02 Thread euromark
if you used utf8 correctly, it would not do that... On 2 Dez., 08:55, Ernesto wrote: > Hello. > > i have a controller, a model and the usual add/remove/edit views > > in the add view i have a simple form. here's the code > > echo $form->input("Items.0.code"); > echo $form->input("Items.0.descrip

Re: Here is my database schema,please peovide me model for his.

2009-12-02 Thread John Andersen
Hi Anand, Sorry, I am using Google Groups, can't see any attachments. John On Dec 2, 11:04 am, anand angadi wrote: > Hi John, > > Here I am attatching my database schema.So can you provide me the sample > model. > > Cheers: > Anand Check out the new CakePHP Questions site http://cakeqs.org a

Here is my database schema,please peovide me model for his.

2009-12-02 Thread anand angadi
Hi John, Here I am attatching my database schema.So can you provide me the sample model. Cheers: Anand 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 "Ca

HtmlHelper link method problem

2009-12-02 Thread Bogdan I. Bursuc
Hello everyone, I have a strange problem with routes and html helper. I have the following routes: Router::connect('/view-category/:category-url/page-:page/', array('controller' => 'frontend_pages', 'action' => 'view_category'), array( 'pass' => array('category-url'), 'category-u