Re: CPAMF plugin, Auth and Encryption - anyone got any experience?

2009-09-30 Thread designvoid

Guess thats a no then... LOL!

If I have any success I'll try and write something for the bakery.

t.

On Sep 29, 12:11 pm, "designv...@gmail.com" 
wrote:
> Hi there,
>
> I'm looking at starting a new project that is going to need to use the
> CPAMF plugin, CakePHP Auth and Encryption (for communicating between
> Flash and CakePHP).
>
> Has anyone had any experience if this sort of project?
>
> I have got CPAMF all set up and have some dummy controller methods in
> CakePHP working for sending and recieving info via the CPAMF browser
> so thats all cool.
>
> Just wondered how I'm going to be able to integrate with Auth
> Component and also make sure the communication is encrypted...
>
> I also found the rc4crypt class for PHP and got that working as a
> vendor, apparently there is the same for Flash, so maybe that is the
> way forward?
>
> Any thoughts, advice, words of warning would be gratefully recieved!
>
> TIA,
>
> toby.
--~--~-~--~~~---~--~~
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 this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: webroot and htaccess

2009-08-20 Thread designvoid

Nope, still no joy!

Thanks tho! Thought that might have been the one... :(



On Aug 19, 4:04 pm, Jamie  wrote:
> You just need to make the forward slash optional in the regular
> expression. So this:
>
> RewriteCond %{REQUEST_URI} ^/forums/(.*)$
>
> Becomes this:
>
> RewriteCond %{REQUEST_URI} ^/forums/?(.*)$
>
> The question mark after the slash makes it optional.
>
> - Jamie
>
> On Aug 19, 1:13 am, designvoid  wrote:
>
> > I have tried duplicating the lines and removing the trailing slash and
> > also removing it from the existing lines but to no avail...
>
> > Any ideas?
>
> > On Aug 19, 3:55 am, brian  wrote:
>
> > > Just remove the trailing slash from the rule:
>
> > > RewriteCond %{REQUEST_URI} ^/forums(.*)$
>
> > > On Tue, Aug 18, 2009 at 8:02 PM,
>
> > > designv...@gmail.com wrote:
>
> > > > Hi there,
>
> > > > I have some forums in my webroot and have added the following to my
> > > > htaccess:
>
> > > >   RewriteCond %{REQUEST_URI} ^/forums/(.*)$
> > > >   RewriteRule ^.*$ - [L]
>
> > > > And this is fine if I type:
>
> > > >  www.mydomain.com/forums/
>
> > > > However if I dont put the trailing slash (www.mydomain.com/forums) I
> > > > get redirected to:
>
> > > >  www.mydomain.com/app/webroot/forums/
>
> > > > Can anyone help with a quick fix or suggestion?
>
> > > > TIA
>
> > > > d.
--~--~-~--~~~---~--~~
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 this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: webroot and htaccess

2009-08-19 Thread designvoid

I have tried duplicating the lines and removing the trailing slash and
also removing it from the existing lines but to no avail...

Any ideas?



On Aug 19, 3:55 am, brian  wrote:
> Just remove the trailing slash from the rule:
>
> RewriteCond %{REQUEST_URI} ^/forums(.*)$
>
> On Tue, Aug 18, 2009 at 8:02 PM,
>
> designv...@gmail.com wrote:
>
> > Hi there,
>
> > I have some forums in my webroot and have added the following to my
> > htaccess:
>
> >   RewriteCond %{REQUEST_URI} ^/forums/(.*)$
> >   RewriteRule ^.*$ - [L]
>
> > And this is fine if I type:
>
> >  www.mydomain.com/forums/
>
> > However if I dont put the trailing slash (www.mydomain.com/forums) I
> > get redirected to:
>
> >  www.mydomain.com/app/webroot/forums/
>
> > Can anyone help with a quick fix or suggestion?
>
> > TIA
>
> > d.
--~--~-~--~~~---~--~~
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 this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Launched a new cake app

2009-05-19 Thread designvoid

Great work man!

Out of interest, what are you using for the forums? Did you write them
yourself?

If so, would you consider giving some insight, maybe a write up for
the Bakery or even release some code? ;)

Ayways, top work!

d//t


On May 17, 6:20 am, Miles J  wrote:
> I redid one of my old sites in CakePHP, it can be found 
> here:http://www.sc2armory.com/
>
> Another app of mine is:http://www.gamesync.com/
--~--~-~--~~~---~--~~
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 this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: afterSave best practice - feedback wanted!

2009-03-26 Thread designvoid

Actually I had made a mistake!!

Forgot to add:

$this->Topic->Forum->id = $forum_id;

Before the Save

ooops!

On Mar 26, 4:45 pm, designvoid  wrote:
> Cheers for replying, I'm using counterCache for the belongsTo
> relationships, but this is for post count in the forum so its
> effectively 2 relationships away, so I kinda work my way back up to
> forum then increment the post count.
>
> Its basically to stop myself using counts etc...
>
> As I said, it works fine, just had that nagging feeling there might be
> a better way! ;)
>
> t.
>
> On Mar 26, 3:15 pm, Martin Westin  wrote:
>
> > CounterCache?
> > Depends on the relationship you are using and a few other bits but if
> > you want to keep track of how many topis a forum has then it should
> > work for you.
>
> >http://book.cakephp.org/view/490/counterCache-Cache-your-count
>
> > On Mar 26, 3:36 pm, "designv...@gmail.com" 
> > wrote:
>
> > > I have written this:
>
> > >         function afterSave($created) {
> > >             if($created == true) {
> > >                 $forum_id = $this->Topic->field('forum_id', 
> > > array('Topic.id'
> > > => $this->data['Post']['topic_id']));
> > >                 $forum_posts = $this->Topic->Forum->field('post_count', 
> > > array
> > > ('Forum.id' => $forum_id));
> > >                 $this->Topic->Forum->saveField('post_count', $forum_posts 
> > > +
> > > 1);
> > >             }
> > >         }
>
> > > And it works fine, but... is it the best 'Cake' way of doing this?
>
> > > TIA
> > > t.
--~--~-~--~~~---~--~~
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 this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: afterSave best practice - feedback wanted!

2009-03-26 Thread designvoid

Cheers for replying, I'm using counterCache for the belongsTo
relationships, but this is for post count in the forum so its
effectively 2 relationships away, so I kinda work my way back up to
forum then increment the post count.

Its basically to stop myself using counts etc...

As I said, it works fine, just had that nagging feeling there might be
a better way! ;)

t.

On Mar 26, 3:15 pm, Martin Westin  wrote:
> CounterCache?
> Depends on the relationship you are using and a few other bits but if
> you want to keep track of how many topis a forum has then it should
> work for you.
>
> http://book.cakephp.org/view/490/counterCache-Cache-your-count
>
> On Mar 26, 3:36 pm, "designv...@gmail.com" 
> wrote:
>
> > I have written this:
>
> >         function afterSave($created) {
> >             if($created == true) {
> >                 $forum_id = $this->Topic->field('forum_id', array('Topic.id'
> > => $this->data['Post']['topic_id']));
> >                 $forum_posts = $this->Topic->Forum->field('post_count', 
> > array
> > ('Forum.id' => $forum_id));
> >                 $this->Topic->Forum->saveField('post_count', $forum_posts +
> > 1);
> >             }
> >         }
>
> > And it works fine, but... is it the best 'Cake' way of doing this?
>
> > TIA
> > t.
--~--~-~--~~~---~--~~
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 this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: afterSave best practice - feedback wanted!

2009-03-26 Thread designvoid

Cheers for replying, I'm using counterCache for the belongsTo
relationships, but this is for post count in the forum so its
effectively 2 relationships away, so I kinda work my way back up to
forum then increment the post count.

Its basically to stop myself using counts etc...

As I said, it works fine, just had that nagging feeling there might be
a better way! ;)

t.

On Mar 26, 3:15 pm, Martin Westin  wrote:
> CounterCache?
> Depends on the relationship you are using and a few other bits but if
> you want to keep track of how many topis a forum has then it should
> work for you.
>
> http://book.cakephp.org/view/490/counterCache-Cache-your-count
>
> On Mar 26, 3:36 pm, "designv...@gmail.com" 
> wrote:
>
> > I have written this:
>
> >         function afterSave($created) {
> >             if($created == true) {
> >                 $forum_id = $this->Topic->field('forum_id', array('Topic.id'
> > => $this->data['Post']['topic_id']));
> >                 $forum_posts = $this->Topic->Forum->field('post_count', 
> > array
> > ('Forum.id' => $forum_id));
> >                 $this->Topic->Forum->saveField('post_count', $forum_posts +
> > 1);
> >             }
> >         }
>
> > And it works fine, but... is it the best 'Cake' way of doing this?
>
> > TIA
> > t.
--~--~-~--~~~---~--~~
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 this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is this a crazy phbBB3 & CakePHP idea?

2008-08-20 Thread designvoid

Yeah that was my plan, and how I have executed it.

Seems to be working well, especially with Containable there to really
target exactly what I want returned.
Add to that the caching engine and I reckon this is gonna be a nice
little bridge between my site and my forums.

If by any chance anyone else fancies doin this and wants a headstart
just ask and I'll stick the files up somewhere, but in all honesty
once you figure out PhpBB's DB naming conventions and relationships
its a doddle.

I'm not bothering tryin to integrate log in/out tho - far too much
work for a 'cute' feature... ;-)

t.

On Aug 20, 12:36 am, rtconner <[EMAIL PROTECTED]> wrote:
> Yes you can do that, no problem. Just gotta use the $useTable var in
> the models.
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Is this a crazy phbBB3 & CakePHP idea?

2008-08-19 Thread designvoid

Hey all!

Just been playing around with phpBB3 and Cake and had this crazy idea!
I have a large forum and want to build a website around it, and want
to use cake to build the site. Now I want to include content from the
forums ie posts and topics on certain pages, so I had this thought!

I could create models for the specific phpBB3 tables that I need data
from, set the correct relationships, then 'use' them in the
controllers that I want to pull phpBB3 content into.

Does that make sense and are there any glaring issues I'm missing in
what seems like a very easy solution...?

TIA,
d.
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: saveAll() not inserting related id

2008-08-19 Thread designvoid

Is anyone able to shed any light on this??

I've put it aside for a while, but I need to figure this out now. So
anyone able to help?

TIA,
d.

On Aug 5, 12:43 pm, designvoid <[EMAIL PROTECTED]> wrote:
> Oh and I should mention i'm using v1.2
> And...
>
> ...editing and adding new variations via the edit method WORKS! I'm
> confused! It seems to work when the product id is there as a hidden
> field for edit, but it doesnt insert last id when adding a new
> product... hmmm!
>
> On Aug 5, 12:38 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > Hi there!
>
> > I'm currently trying to use thesaveAll() function with the following
> > set up:
>
> > Products haveMany Variations
> > Variations belongTo Products
>
> > However when I execute the add function in the Products controller:
>
> > if (!empty($this->data)) {
> >         $this->Product->create();
> >         if ($this->Product->saveAll($this->data)) {
> >                 $this->Session->setFlash(__('The Product has been saved', 
> > true));
> >                 $this->redirect(array('action'=>'index'));
> >         } else {
> >                 $this->Session->setFlash(__('The Product could not be 
> > saved. Please,
> > try again.', true));
> >         }
>
> > }
>
> > The rows are inserted but the the related Variations are missing the
> > Product id!
>
> > The SQL dump shows this:
>
> > START TRANSACTION
> > INSERT INTO `products` (`name`,`price`) VALUES ('save all test',10.00)
> > SELECT LAST_INSERT_ID() AS insertID
> > INSERT INTO `variations`
> > (`name`,`stock`,`price_modifier`,`product_id`) VALUES ('qq',
> > 15,3.00,'')                     SELECT LAST_INSERT_ID() AS insertID
> > INSERT INTO `variations`
> > (`name`,`stock`,`price_modifier`,`product_id`) VALUES ('ww',
> > 15,3.00,'')
> > SELECT LAST_INSERT_ID() AS insertID
> > COMMIT
>
> > Can anyone shed any light on this?
> > TIA!
> > d.
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Where is the flashMessage div constructed? Trying to created multiple flashes

2008-02-18 Thread designvoid

Hi all,

I'm trying to create multiple flash messages ie an error message and a
success message, I have it to show the error message and the standard
flash, but the standard has a div around it and my own error one just
dumps the passed error... I'm using the stable release not the beta...

Can anyone advise me on how to make them both show in the div but with
different classes?

TIA,

toby.
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Save data from model x with model y with different fieldnames

2008-02-01 Thread designvoid

HAHA!

Figured it out!

Cake ignores array items that don't match when saving, so i can just
add hidden fields for the different fields in the second model and
then just save!

Sound about right?

On Feb 1, 12:29 pm, designvoid <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I have a shopping cart table with associated tables and an orders
> table with associated tables, I want to move the shopping cart data
> into the orders tables once the user clicks checkout.
>
> The cart and orders tables have 2 differently named fields but are
> essentially the same (im using orders to keep perminant record and the
> cart is temporary).
>
> Any thoughts how I can achive this without doing some horrid array
> looping kludge?
>
> TIA,
>
> toby.
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Save data from model x with model y with different fieldnames

2008-02-01 Thread designvoid

Hi there,

I have a shopping cart table with associated tables and an orders
table with associated tables, I want to move the shopping cart data
into the orders tables once the user clicks checkout.

The cart and orders tables have 2 differently named fields but are
essentially the same (im using orders to keep perminant record and the
cart is temporary).

Any thoughts how I can achive this without doing some horrid array
looping kludge?

TIA,

toby.
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Looking for help working through a logic problem (shopping cart related)

2008-01-25 Thread designvoid

Hi all,

I'm currently trying to complete what I thought would be a fairly
simple shopping cart, however I have run into some issues with the
logic side of add/updating a users cart.

As it stands I have a cart table & a cart options table (to store
users product variation choices), now I have it successfully checking
for the existance of an existing product in the cart and incrementing
quantity if found, and adding the relevant variation option (via a
foreach loop on the posted data array and cartoption->save). It
currently is set up so a product can have limitless variations so
thats also a bit of a headache looping through every variation choice
once the product is added to the cart.

As it stands it will increment the cart qty if there is a match BUT
add a new entry in the cart options table regardless.

I cannot seem to work out a logical way to check for duplicate
submission using BOTH tables ie exactly same product and options being
added to the cart...

Any thoughts, ideas, suggestions would be greatfully recieved - I'm
not looking for someone to code it for me, just help me work thru the
logic and hopefully generate some good ideas!

Thanks,

toby.



--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Differing Array structures with HABTM find requests? Multiple Views?

2008-01-18 Thread designvoid

Ok, I have had a good search on filtering HABTM and also found your
earlier post on this, but haven't had any joy getting it working, is
it possible you could give a slightly more detailed example?

I really don't want to get beaten by this as I have pretty much
everything else nailed, I've used BAKE and everything working fine,
and I've redesigned all the pages, even got LDAP and multiple
checkboxes working but its just these little extra bits of
functionality imposed by the interface design that are causing
headaches...

Again, thanks for your time!

toby.

On Jan 18, 9:42 am, designvoid <[EMAIL PROTECTED]> wrote:
> Excellent! Many thanks, I will search for more info on this and
> hopefully solve this!
>
> I had searched the group many times, in fact I read thru the group
> daily at the moment as I'm trying to learn as much as poss, its just
> trick sometimes knowing exactly what to search for as I'm still not
> 100% with specific terminology.
>
> Anyways, thanks again for the tip!! :-)
>
> On Jan 18, 9:37 am, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Jan 18, 10:29 am, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > Noone able to add any insight to this?
>
> > There is a lot of insight already listed on the frequent discussions
> > page.
>
> > The really really easy solution is to make a model of your join table
> > and call $this->Project->ProjectsTeam->findAll($conditons); in both
> > cases.
>
> > hth,
>
> > AD
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Differing Array structures with HABTM find requests? Multiple Views?

2008-01-18 Thread designvoid

Excellent! Many thanks, I will search for more info on this and
hopefully solve this!

I had searched the group many times, in fact I read thru the group
daily at the moment as I'm trying to learn as much as poss, its just
trick sometimes knowing exactly what to search for as I'm still not
100% with specific terminology.

Anyways, thanks again for the tip!! :-)

On Jan 18, 9:37 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Jan 18, 10:29 am, designvoid <[EMAIL PROTECTED]> wrote:
>
> > Noone able to add any insight to this?
>
> There is a lot of insight already listed on the frequent discussions
> page.
>
> The really really easy solution is to make a model of your join table
> and call $this->Project->ProjectsTeam->findAll($conditons); in both
> cases.
>
> hth,
>
> AD
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Differing Array structures with HABTM find requests? Multiple Views?

2008-01-18 Thread designvoid

Noone able to add any insight to this? Sorry to bump, I know its
annoying, but I'm loathed push forward with this app if I'm unsure
about cases like this...
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Differing Array structures with HABTM find requests? Multiple Views?

2008-01-17 Thread designvoid

Hi all,

I have a page that displays a list of projects, projects can habtm
teams and vice versa, when the page first loads the $projects array is
populated via:

$this->set('projects', $this->Project->findAll());

Which returns ALL projects. Now on the page there is a select box that
posts back to the controller an id of a team in order to show projects
JUST for that team. This time the projects array is filled via:

$this->set('projects', $this->Project->Team->find(array('Team.id' =>
$_POST['team_id'])));

My problem is that these two requests return different array
structures, so my index.thtml is fine for the initial view all, but
falls over for the other request.

I have currently got around the problem by creating a second view file
and call 'render('secondview')' which is altered to accept the
different array (ie the looping etc)

What I want to know is if this is the correct way of doing this or
have I missed something fundamental?

TIA,

toby.
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



generateList - problem with conditions and multiple tables

2008-01-16 Thread designvoid

Hi all,

Hoping someone can help me with this, I'm using stable cake release
and trying to use generateList using conditions based on multiple
models.

I have a team model:

class Team extends AppModel {

var $name = 'Team';
var $validate = array(
'name' => VALID_NOT_EMPTY,
'leader' => VALID_NUMBER,
);

//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $belongsTo = array(
'Leader' =>
array('className' => 'User',
'foreignKey' => 'leader',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => ''
),

);

var $hasAndBelongsToMany = array(
'Project' =>
array('className' => 'Project',
'joinTable' => 'projects_teams',
'foreignKey' => 'team_id',
'associationForeignKey' => 
'project_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'unique' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
),

'User' =>
array('className' => 'User',
'joinTable' => 'teams_users',
'foreignKey' => 'team_id',
'associationForeignKey' => 
'user_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'unique' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
),

);

}

-

And a user model:

class User extends AppModel {

var $name = 'User';
var $validate = array(
'mmu_id' => VALID_NOT_EMPTY,
'name' => VALID_NOT_EMPTY,
'phone' => VALID_NUMBER,
'email' => VALID_NOT_EMPTY,
);

//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $hasOne = array(
'Project' =>
array('className' => 'Project',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => '',
'dependent' => ''
),

);

var $hasMany = array(
'Message' =>
array('className' => 'Message',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'dependent' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),

);

var $hasAndBelongsToMany = array(
'Job' =>
array('className' => 'Job',
'joinTable' => 'jobs_users',

Frustration with FileHandler snippet and saving returned value, any advice?

2007-12-13 Thread designvoid

Hi there,

I'm currently playing with the FileHandler snippet by Chris Partridge
(http://cakeforge.org/snippet/detail.php?type=snippet&id=52) and I've
hit a problem!

I can get the file to upload correctly and saved in the correct
location, but I cannot for the life of me get the filename back into
the the data array for storing in the database...

My current code is below:

Model:

uses('file_handler');
class News extends AppModel
{
var $name = 'News';

function beforeSave()
{
$FileHandler =& new FileHandler();
$this->params['data']['image'] = $FileHandler-
>save($_FILES['image']['tmp_name'], $_FILES['image']['name'], 'img/
news/', true);
return true;
}

}


Controller:

function add()
{
if (empty($this->params['data']))
{
$this->render();
}
else
{
if ($this->News->save($this->params['data']))
{
$this->flash('Your News has been saved.','/news');
}
else
{
$this->set('data', $this->params['data']);
$this->render('edit');
}
}
}


It uploads the file aok and adds a db entry, just without any data in
the image field. I'm sure it must be something I'm overlooking, but
I'm stumped!

Any help would be gratefully recieved,

d.
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Code critique? Anyone spare 5 mins to look over something?

2007-12-03 Thread designvoid

Hi all!

I'm in the process of building my first app with Cake and was
wondering if someone could look over some code and let me know if what
I have done is correct or waay off base...

Its basically a few lines to get 3 different arrays populated with
data from 2 tables via a HABTM releationship.

It gets a bit complicated when I try and use conditions from each
table, but hopefully to you guys it should make sense.. anyways, here
it is:

//closed jobs
 $this->Job->User->recursive = 3;
 $this->Job->unbindModel(array('hasMany'=>array('Notes')));
 $this->Job->User-
>unbindModel(array('hasAndBelongsToMany'=>array('Modules')));
 $conditions = array("status_id" => 3);
 $this->set('closed_jobs', $this->Job->findAll($conditions));

//user's open jobs
$this->Job->unbindModel(array('hasMany'=>array('Notes')));
$this->Job->bindModel(array('hasOne'=>array('JobUser'=>array(;
$constraint['Job.status_id'] = '<> 3';
$constraint['JobUser.user_id'] = $this->Session->read('User');
$this->set('user_jobs', $this->Job->findAll($constraint));

//other user's open jobs
$this->Job->unbindModel(array('hasMany'=>array('Notes')));
$this->Job->bindModel(array('hasOne'=>array('JobUser'=>array(;
$constraint['Job.status_id'] = '<> 3';
$constraint['JobUser.user_id'] = '<> '.$this->Session-
>read('User');
$this->set('others_jobs', $this->Job->findAll($constraint));

If I'm doing things correctly then great!! If not, a pointer or 2
would be gratefully recieved!

TIA,

d.
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Strange recursion problem (i think) - hopefully someone can shed some light (code inc.)

2007-11-26 Thread designvoid

Sorted! It was that plural, dropped the 's' and BINGO!

d.

On Nov 24, 7:15 pm, designvoid <[EMAIL PROTECTED]> wrote:
> The uses array is only there to test the Variations call, I would
> remove it in finished thing.
>
> The plurals are the names of the arrays I thought, and as such didn't
> matter what I called them..?
>
> Also, I dont like the convention of naming id fields 'just' id, I'm
> cool with the config options tho, I can handle that...
>
> Cheers for the points tho, I'll definately check out that 'belongs'
> issue!
>
> Cheers,
>
> d.
>
> On Nov 24, 10:20 am, "DJ Spark" <[EMAIL PROTECTED]> wrote:
>
> >  also, you don't need, usually, to use more than one model per
> > controller ( uses('Model1', 'Model2') ), if they are associated
> > somehow:
> > this
> >  $this->Variations->findAll()
>
> > could be
> >  $this->Product->Variation->findAll()
>
> >  I didn't run any tests, but I can see some points:
>
> > class VariationOption extends AppModel
> > {
> >var $name = 'VariationOption';
> >var $primaryKey = 'vo_id';
>
> >  // Add this to ensure the association
> >var $belongsTo = 'Variation';
>
> > }
>
> > Also, in the Product association, I can see a plural there
>
> > var $hasAndBelongsToMany = array('Variations' =>
> >   array('className'=> 'Variation',
>
> > try changing it to singular form:
>
> > var $hasAndBelongsToMany = array('Variation' =>
> >   array('className'=> 'Variation',
>
> > And setting the HABTM association also on the VariationOption model
>
> > If you area starting with cake, i'd also suggest to *really* use all
> > cake conventions, like db table 'id' :)
> > Doing so, you would need all those HABTM options, like table_name,
> > primary key, et cetera.
>
> > Spark
>
> > On Nov 23, 2007 9:01 PM, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > I have full debug on and all the queries seem to be correct.
>
> > > If I change:
>
> > > $this->set('products', $this->Product->findAll());
>
> > > to
>
> > > $this->set('products', $this->Variations->findAll());
>
> > > it it comes back with the variations and associated options fine! So
> > > it seems the join between 'groups' the 2 is screwy somewhere... i can
> > > return products and vars and vars and options but not all in one go!
> > > LOL!
>
> > > d.
>
> > > On Nov 23, 9:58 pm, bingo <[EMAIL PROTECTED]> wrote:
> > > > hi designvoid
>
> > > > I am 100% confident it has something to do with how setup HABTM
> > > > (belongsTo, etc) relationships. CakePHP is pretty good in dealing with
> > > > recursive queries. One way to figure out what's happing is to use
> > > > debug mode  = 2 . That will print out all the SQL queries and will
> > > > allow to see what's going on.
>
> > > > Regards,
>
> > > > On Nov 23, 3:15 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi Bingo,
>
> > > > > Cheers for the heads up on that - I'll definately give it a shot!
>
> > > > > I'm still wondering tho, is it my code that is the problem or a
> > > > > limitation of Cake? I'd like to fully understand why this issue is
> > > > > occuring before moving on to other scripts etc...
>
> > > > > d.
>
> > > > > On Nov 23, 8:00 pm, bingo <[EMAIL PROTECTED]> wrote:
>
> > > > > > hi designvoid,
>
> > > > > > I would suggest you that you get that script. In my experience of
> > > > > > using CakePHP, I found it very useful. But I started using that 
> > > > > > script
> > > > > > before CakePHP 1.2 came into existence and continuing to still use 
> > > > > > it
> > > > > > in 1.2. You might also want to see if 1.2 has any such 
> > > > > > functionality.
>
> > > > > > Regards
>
> > > > > > On Nov 23, 1:49 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I'm not using that script, I'm relatively new to Cake, making good
> >

Re: Strange recursion problem (i think) - hopefully someone can shed some light (code inc.)

2007-11-24 Thread designvoid

The uses array is only there to test the Variations call, I would
remove it in finished thing.

The plurals are the names of the arrays I thought, and as such didn't
matter what I called them..?

Also, I dont like the convention of naming id fields 'just' id, I'm
cool with the config options tho, I can handle that...

Cheers for the points tho, I'll definately check out that 'belongs'
issue!

Cheers,

d.

On Nov 24, 10:20 am, "DJ Spark" <[EMAIL PROTECTED]> wrote:
>  also, you don't need, usually, to use more than one model per
> controller ( uses('Model1', 'Model2') ), if they are associated
> somehow:
> this
>  $this->Variations->findAll()
>
> could be
>  $this->Product->Variation->findAll()
>
>  I didn't run any tests, but I can see some points:
>
> class VariationOption extends AppModel
> {
>var $name = 'VariationOption';
>var $primaryKey = 'vo_id';
>
>  // Add this to ensure the association
>var $belongsTo = 'Variation';
>
> }
>
> Also, in the Product association, I can see a plural there
>
> var $hasAndBelongsToMany = array('Variations' =>
>   array('className'=> 'Variation',
>
> try changing it to singular form:
>
> var $hasAndBelongsToMany = array('Variation' =>
>   array('className'=> 'Variation',
>
> And setting the HABTM association also on the VariationOption model
>
> If you area starting with cake, i'd also suggest to *really* use all
> cake conventions, like db table 'id' :)
> Doing so, you would need all those HABTM options, like table_name,
> primary key, et cetera.
>
> Spark
>
> On Nov 23, 2007 9:01 PM, designvoid <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > I have full debug on and all the queries seem to be correct.
>
> > If I change:
>
> > $this->set('products', $this->Product->findAll());
>
> > to
>
> > $this->set('products', $this->Variations->findAll());
>
> > it it comes back with the variations and associated options fine! So
> > it seems the join between 'groups' the 2 is screwy somewhere... i can
> > return products and vars and vars and options but not all in one go!
> > LOL!
>
> > d.
>
> > On Nov 23, 9:58 pm, bingo <[EMAIL PROTECTED]> wrote:
> > > hi designvoid
>
> > > I am 100% confident it has something to do with how setup HABTM
> > > (belongsTo, etc) relationships. CakePHP is pretty good in dealing with
> > > recursive queries. One way to figure out what's happing is to use
> > > debug mode  = 2 . That will print out all the SQL queries and will
> > > allow to see what's going on.
>
> > > Regards,
>
> > > On Nov 23, 3:15 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > > Hi Bingo,
>
> > > > Cheers for the heads up on that - I'll definately give it a shot!
>
> > > > I'm still wondering tho, is it my code that is the problem or a
> > > > limitation of Cake? I'd like to fully understand why this issue is
> > > > occuring before moving on to other scripts etc...
>
> > > > d.
>
> > > > On Nov 23, 8:00 pm, bingo <[EMAIL PROTECTED]> wrote:
>
> > > > > hi designvoid,
>
> > > > > I would suggest you that you get that script. In my experience of
> > > > > using CakePHP, I found it very useful. But I started using that script
> > > > > before CakePHP 1.2 came into existence and continuing to still use it
> > > > > in 1.2. You might also want to see if 1.2 has any such functionality.
>
> > > > > Regards
>
> > > > > On Nov 23, 1:49 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > > > > I'm not using that script, I'm relatively new to Cake, making good
> > > > > > progress but this has stumped me...
>
> > > > > > Is that script needed to do what I want? Or is there a way in 
> > > > > > vanilla
> > > > > > Cake?
>
> > > > > > t.
>
> > > > > > On Nov 23, 6:19 pm, bingo <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I guess you need to set  (assuming you are using unbindModel 
> > > > > > > scripthttp://bakery.cakephp.org/articles/view/an-improvement-to-unbindmodel...)
>
> > >

Re: Strange recursion problem (i think) - hopefully someone can shed some light (code inc.)

2007-11-23 Thread designvoid

I have full debug on and all the queries seem to be correct.

If I change:

$this->set('products', $this->Product->findAll());

to

$this->set('products', $this->Variations->findAll());

it it comes back with the variations and associated options fine! So
it seems the join between 'groups' the 2 is screwy somewhere... i can
return products and vars and vars and options but not all in one go!
LOL!

d.



On Nov 23, 9:58 pm, bingo <[EMAIL PROTECTED]> wrote:
> hi designvoid
>
> I am 100% confident it has something to do with how setup HABTM
> (belongsTo, etc) relationships. CakePHP is pretty good in dealing with
> recursive queries. One way to figure out what's happing is to use
> debug mode  = 2 . That will print out all the SQL queries and will
> allow to see what's going on.
>
> Regards,
>
> On Nov 23, 3:15 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > Hi Bingo,
>
> > Cheers for the heads up on that - I'll definately give it a shot!
>
> > I'm still wondering tho, is it my code that is the problem or a
> > limitation of Cake? I'd like to fully understand why this issue is
> > occuring before moving on to other scripts etc...
>
> > d.
>
> > On Nov 23, 8:00 pm, bingo <[EMAIL PROTECTED]> wrote:
>
> > > hi designvoid,
>
> > > I would suggest you that you get that script. In my experience of
> > > using CakePHP, I found it very useful. But I started using that script
> > > before CakePHP 1.2 came into existence and continuing to still use it
> > > in 1.2. You might also want to see if 1.2 has any such functionality.
>
> > > Regards
>
> > > On Nov 23, 1:49 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > > I'm not using that script, I'm relatively new to Cake, making good
> > > > progress but this has stumped me...
>
> > > > Is that script needed to do what I want? Or is there a way in vanilla
> > > > Cake?
>
> > > > t.
>
> > > > On Nov 23, 6:19 pm, bingo <[EMAIL PROTECTED]> wrote:
>
> > > > > I guess you need to set  (assuming you are using unbindModel 
> > > > > scripthttp://bakery.cakephp.org/articles/view/an-improvement-to-unbindmodel...)
>
> > > > > $this->Product->Variations->expects('Options);
> > > > > $this->Product->expects('Variations);
> > > > > $this->set('products', $this->Product->findAll());
>
> > > > > bingo
>
> > > > > On Nov 23, 12:59 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hi all,
>
> > > > > > I'm having a wierd issue when trying to use 3 models together via 1
> > > > > > findAll()... I'll paste the code then, explain what's happening,
> > > > > > fingers crossed one I you fine folk will be able to give a me a
> > > > > > pointer as to what I'm missing...
>
> > > > > > Basic overview:
>
> > > > > > Products has multiple Variations and Variations have multiple 
> > > > > > Options
>
> > > > > > Code:
>
> > > > > > class Product extends AppModel {
> > > > > >var $name = 'Product';
> > > > > >var $primaryKey = 'p_id';
>
> > > > > > var $hasAndBelongsToMany = array('Variations' =>
> > > > > >array('className'=>
> > > > > > 'Variation',
> > > > > >  'joinTable'=>
> > > > > > 'products_variations',
> > > > > >  'foreignKey'   => 'p_id',
> > > > > >  'associationForeignKey'=>
> > > > > > 'v_id',
> > > > > >  'conditions'   => '',
> > > > > >  'order'=> '',
> > > > > >  'limit'=> '',
> > > > > >  'unique'   => tr

Re: Strange recursion problem (i think) - hopefully someone can shed some light (code inc.)

2007-11-23 Thread designvoid

Hi Bingo,

Cheers for the heads up on that - I'll definately give it a shot!

I'm still wondering tho, is it my code that is the problem or a
limitation of Cake? I'd like to fully understand why this issue is
occuring before moving on to other scripts etc...

d.

On Nov 23, 8:00 pm, bingo <[EMAIL PROTECTED]> wrote:
> hi designvoid,
>
> I would suggest you that you get that script. In my experience of
> using CakePHP, I found it very useful. But I started using that script
> before CakePHP 1.2 came into existence and continuing to still use it
> in 1.2. You might also want to see if 1.2 has any such functionality.
>
> Regards
>
> On Nov 23, 1:49 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > I'm not using that script, I'm relatively new to Cake, making good
> > progress but this has stumped me...
>
> > Is that script needed to do what I want? Or is there a way in vanilla
> > Cake?
>
> > t.
>
> > On Nov 23, 6:19 pm, bingo <[EMAIL PROTECTED]> wrote:
>
> > > I guess you need to set  (assuming you are using unbindModel 
> > > scripthttp://bakery.cakephp.org/articles/view/an-improvement-to-unbindmodel...)
>
> > > $this->Product->Variations->expects('Options);
> > > $this->Product->expects('Variations);
> > > $this->set('products', $this->Product->findAll());
>
> > > bingo
>
> > > On Nov 23, 12:59 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > > Hi all,
>
> > > > I'm having a wierd issue when trying to use 3 models together via 1
> > > > findAll()... I'll paste the code then, explain what's happening,
> > > > fingers crossed one I you fine folk will be able to give a me a
> > > > pointer as to what I'm missing...
>
> > > > Basic overview:
>
> > > > Products has multiple Variations and Variations have multiple Options
>
> > > > Code:
>
> > > > class Product extends AppModel {
> > > >var $name = 'Product';
> > > >var $primaryKey = 'p_id';
>
> > > > var $hasAndBelongsToMany = array('Variations' =>
> > > >array('className'=>
> > > > 'Variation',
> > > >  'joinTable'=>
> > > > 'products_variations',
> > > >  'foreignKey'   => 'p_id',
> > > >  'associationForeignKey'=>
> > > > 'v_id',
> > > >  'conditions'   => '',
> > > >  'order'=> '',
> > > >  'limit'=> '',
> > > >  'unique'   => true,
> > > >  'finderQuery'  => '',
> > > >  'deleteQuery'  => '',
> > > >)
> > > > );
>
> > > > }
>
> > > > --
>
> > > > class Variation extends AppModel
> > > > {
> > > > var $name = 'Variation';
> > > > var $primaryKey = 'v_id';
>
> > > > var $hasMany = array('Options' =>
> > > >  array('className' => 'VariationOption',
> > > >'conditions'=> '',
> > > >'order' => '',
> > > >'limit' => '',
> > > >'foreignKey'=> 'vo_v_id',
> > > >'dependent' => '',
> > > >'exclusive' => '',
> > > >'finderQuery'   => '',
> > > >'fields'=> '',
> > >

Re: Strange recursion problem (i think) - hopefully someone can shed some light (code inc.)

2007-11-23 Thread designvoid

I'm not using that script, I'm relatively new to Cake, making good
progress but this has stumped me...

Is that script needed to do what I want? Or is there a way in vanilla
Cake?

t.

On Nov 23, 6:19 pm, bingo <[EMAIL PROTECTED]> wrote:
> I guess you need to set  (assuming you are using unbindModel 
> scripthttp://bakery.cakephp.org/articles/view/an-improvement-to-unbindmodel...)
>
> $this->Product->Variations->expects('Options);
> $this->Product->expects('Variations);
> $this->set('products', $this->Product->findAll());
>
> bingo
>
> On Nov 23, 12:59 pm, designvoid <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I'm having a wierd issue when trying to use 3 models together via 1
> > findAll()... I'll paste the code then, explain what's happening,
> > fingers crossed one I you fine folk will be able to give a me a
> > pointer as to what I'm missing...
>
> > Basic overview:
>
> > Products has multiple Variations and Variations have multiple Options
>
> > Code:
>
> > class Product extends AppModel {
> >var $name = 'Product';
> >var $primaryKey = 'p_id';
>
> > var $hasAndBelongsToMany = array('Variations' =>
> >array('className'=>
> > 'Variation',
> >  'joinTable'=>
> > 'products_variations',
> >  'foreignKey'   => 'p_id',
> >  'associationForeignKey'=>
> > 'v_id',
> >  'conditions'   => '',
> >  'order'=> '',
> >  'limit'=> '',
> >  'unique'   => true,
> >  'finderQuery'  => '',
> >  'deleteQuery'  => '',
> >)
> > );
>
> > }
>
> > --
>
> > class Variation extends AppModel
> > {
> > var $name = 'Variation';
> > var $primaryKey = 'v_id';
>
> > var $hasMany = array('Options' =>
> >  array('className' => 'VariationOption',
> >'conditions'=> '',
> >'order' => '',
> >'limit' => '',
> >'foreignKey'=> 'vo_v_id',
> >'dependent' => '',
> >'exclusive' => '',
> >'finderQuery'   => '',
> >'fields'=> '',
> >'offset'=> '',
> >'counterQuery'  => ''
> >  )
> >   );
>
> > }
>
> > --
>
> > class VariationOption extends AppModel
> > {
> > var $name = 'VariationOption';
> > var $primaryKey = 'vo_id';
>
> > }
>
> > -
>
> > Now when I run:
>
> > $this->Product->recursive = 3;
> > $this->set('products', $this->Product->findAll());
>
> > I only get the following back:
>
> > Array
> > (
> > [0] => Array
> > (
> > [Product] => Array
> > (
> > [p_id] => 1
> > [p_name] => A Jumper
> > [p_description] => Its a lovely wooly jumper for
> > the winter
> > [p_image] => jumper.jpg
> > [p_price] => 10.00
> > )
>
> > [Variations] => Array
> > (
> > [0] => Array
> > (
> > [v_id] => 1
> > [v_name] => Sizes
> > )
>
> > )
>
> > )
>
> > 
>
> > Now to my reckoning there should be an Options array under
> > Variations...
>
> > Hope its something simple I've missed and someone can put me straight!
> > Thanks in advance,
> > d.
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Strange recursion problem (i think) - hopefully someone can shed some light (code inc.)

2007-11-23 Thread designvoid

Hi all,

I'm having a wierd issue when trying to use 3 models together via 1
findAll()... I'll paste the code then, explain what's happening,
fingers crossed one I you fine folk will be able to give a me a
pointer as to what I'm missing...

Basic overview:

Products has multiple Variations and Variations have multiple Options

Code:

class Product extends AppModel {
   var $name = 'Product';
   var $primaryKey = 'p_id';

var $hasAndBelongsToMany = array('Variations' =>
   array('className'=>
'Variation',
 'joinTable'=>
'products_variations',
 'foreignKey'   => 'p_id',
 'associationForeignKey'=>
'v_id',
 'conditions'   => '',
 'order'=> '',
 'limit'=> '',
 'unique'   => true,
 'finderQuery'  => '',
 'deleteQuery'  => '',
   )
);
}

--

class Variation extends AppModel
{
var $name = 'Variation';
var $primaryKey = 'v_id';

var $hasMany = array('Options' =>
 array('className' => 'VariationOption',
   'conditions'=> '',
   'order' => '',
   'limit' => '',
   'foreignKey'=> 'vo_v_id',
   'dependent' => '',
   'exclusive' => '',
   'finderQuery'   => '',
   'fields'=> '',
   'offset'=> '',
   'counterQuery'  => ''
 )
  );
}

--

class VariationOption extends AppModel
{
var $name = 'VariationOption';
var $primaryKey = 'vo_id';
}

-

Now when I run:

$this->Product->recursive = 3;
$this->set('products', $this->Product->findAll());

I only get the following back:

Array
(
[0] => Array
(
[Product] => Array
(
[p_id] => 1
[p_name] => A Jumper
[p_description] => Its a lovely wooly jumper for
the winter
[p_image] => jumper.jpg
[p_price] => 10.00
)

[Variations] => Array
(
[0] => Array
(
[v_id] => 1
[v_name] => Sizes
)

)

)



Now to my reckoning there should be an Options array under
Variations...

Hope its something simple I've missed and someone can put me straight!
Thanks in advance,
d.
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Confusing problem with insert/update via AJAX (have exhausted solutions find via search)

2007-11-22 Thread designvoid

Yup, that was it! I'd got totally muddled up.

I have now switched that PK definition to the correct one, and changed
the releationship in the model to 'belongsTo' and everything is hunky
dory!

It was definately one of those 'I've been staring at this for far too
long and can't see the problem...'

Cheers!

d.

On Nov 21, 6:06 pm, mehodgson <[EMAIL PROTECTED]> wrote:
> This may be the problem, in your controller your set:
>
> $this->params['marked_jobs']['Mark']['jm_j_id'] = $j_id;
>
> and in your model your set:
>
> var $primaryKey = 'jm_j_id';
>
> ...so in your controller you are setting the passed value to 'jm_j_id'
> which is the PK.
>
> On Nov 21, 8:34 am, designvoid <[EMAIL PROTECTED]> wrote:
>
> > Hi there!
>
> > I'm trying to perform an insert query via an ajax call, having
> > searched throughout the group, I have come to the conclusion that it
> > is something to do with Cake taking the only parameter passed as the
> > PK and performing an update rather than an insert. I have found posts
> > regarding this suggesting setting the id to null at start of function,
> > using the model->create command etc, but none of these seem to work...
>
> > I'll paste some snippets, this is my view file with the AJAX call:
>
> >  > onClick="new Ajax.Updater('jobs_marked','markit/ > $item['j_id']; ?>', {asynchronous:true, evalScripts:true});" />
>
> > This is my controller function:
>
> > function markit($j_id)
> > {
> > $this->Mark->id = null;
> > $this->params['marked_jobs']['Mark']['jm_j_id'] = $j_id;
>
> > if ($this->Mark->save($this->params['marked_jobs']))
> > {
> > $this->set('jobs', $this->Job->findAll());
> > $this->set('marked_jobs', $this->Mark->findAll());
> > $this->render('marked', 'ajax');
> > }
> > }
>
> > And this is my 'mark' model:
>
> > class Mark extends AppModel {
> > var $name = 'Mark';
> > var $primaryKey = 'jm_j_id';
> > var $useTable = 'jobs_marked';
>
> > var $hasOne = array('Job' =>
> > array('className'=> 'Job',
> > 'conditions'   => '',
> > 'order'=> '',
> > 'dependent'=>  true,
> > 'foreignKey'   => 'j_id'
> > )
> > );
>
> > }
>
> > I hope that this is something simple that I have overlooked and one of
> > you fine people can shed some light on it...
> > TIA,
> > d.

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Confusing problem with insert/update via AJAX (have exhausted solutions find via search)

2007-11-21 Thread designvoid

Hi there!

I'm trying to perform an insert query via an ajax call, having
searched throughout the group, I have come to the conclusion that it
is something to do with Cake taking the only parameter passed as the
PK and performing an update rather than an insert. I have found posts
regarding this suggesting setting the id to null at start of function,
using the model->create command etc, but none of these seem to work...

I'll paste some snippets, this is my view file with the AJAX call:




This is my controller function:

function markit($j_id)
{
$this->Mark->id = null;
$this->params['marked_jobs']['Mark']['jm_j_id'] = $j_id;

if ($this->Mark->save($this->params['marked_jobs']))
{
$this->set('jobs', $this->Job->findAll());
$this->set('marked_jobs', $this->Mark->findAll());
$this->render('marked', 'ajax');
}
}


And this is my 'mark' model:

class Mark extends AppModel {
var $name = 'Mark';
var $primaryKey = 'jm_j_id';
var $useTable = 'jobs_marked';


var $hasOne = array('Job' =>
array('className'=> 'Job',
'conditions'   => '',
'order'=> '',
'dependent'=>  true,
'foreignKey'   => 'j_id'
)
);

}


I hope that this is something simple that I have overlooked and one of
you fine people can shed some light on it...
TIA,
d.

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---