Can't seem to get simple HABTM to save...

2015-01-11 Thread Jake Newsom
So I have 2 models, Posts and Events.

Model Post.php looks like this: 
array(
"className"=>"Event",
"joinTable"=>"events_posts",
"foreignKey"=>"post_id",
"associationForeignKey"=>"event_id",
"unique"=>true
)
);
}
?>

Model Event.php has this: 
public $hasAndBelongsToMany = array(
"Posts"=>array(
"className"=>"Post",
"joinTable"=>"events_posts",
"foreignKey"=>"event_id",
"associationForeignKey"=>"post_id",
"unique"=>true
)
);


In the database there's a table called events_posts with 2 fields: event_id 
& post_id

And finally, in a different controller, where I need to manually save 
stuff I have this code: 
$post_data = array(
"Post"=>array(
"image_id"=>$entry['id'],

"image_url"=>$entry['images']['standard_resolution']['url'],

"image_thumb"=>$entry['images']['low_resolution']['url'],
"image_text"=>$entry['caption']['text'],
"status"=>'1',
"created_on"=>$entry['created_time'],
"instagram_user_id"=>$user_id
),
"Event"=>array(
"id"=>$event['Event']['id']
)
);

$this->Post->saveAll($post_data); 

And I've tried saveAll, save, and saveAssociated. The Post information 
saves, but nothing shows up in the events_posts table. What am I doing 
wrong? I'm sure it's gotta be some kind of alias mistake...

Thanks in advance for taking the time to read and help me!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: I need logic to make private user groups

2014-06-20 Thread Jake
How about getting someone else to do it for you? Oh wait... never mind.
You're all over this!


On Fri, Jun 20, 2014 at 12:40 PM, Salines  wrote:

> Okay friends, I need the following:
>
> enables registered members to dynamically generate user groups, where only
> members of the group can access content within that group. This is
> identical to do facebook group.
>
> So I need some logic, how to do it. thanks
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Trying to learn Auth and Login, can someone upload there files so i can analyze?

2014-06-11 Thread Jake
I would recommend taking a look at the Authake plugin on Github. It is a
little rough around the edges but does give an excellent starting point to
learn from and or extend as required. It provides group management and
regexp powered path rules that are easy to setup.

The fork by msbragi  has bug fixes and
support for SQLite, which can be ignored in favour of MySQL, but is also
informative.

There is also a popular plugin by CakeDC, but I haven't used it before.
Here is a link: https://github.com/CakeDC/users


js


On Tue, Jun 10, 2014 at 10:15 AM, Art Sir  wrote:

> I followed the tutorial on the site but its hard putting it all together.
> And I have been trying to learn on and off. And I forget i have a full time
> job, learning this on the side.
>
> i just want to see how everything is layed out and i can tinker and modify
> so i can understand it. Like a start login and logout. And how the db is
> setup to add users.
>
> Thanks
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Multi-level menu with Modified Preorder Tree Traversal

2014-04-07 Thread Jake
This is a great article, but doesn't have a lot to do with CakePHP. It
certainly spells it out clearly though, and the examples are in PHP.

http://www.sitepoint.com/hierarchical-data-database/




On Sun, Apr 6, 2014 at 3:13 PM, Sam Clauw  wrote:

> Hi Marco, thanks 4 your answer too! I realy do appreciate those great
> scripts you're sending to me. But right now, I still got the problem that I
> can't write the essence of a multi-level menu (without recursion) on my own
> ;)
> Perhaps, you can tell me if / how I can cross my tree-based database table
> and output it in a realy simple  list? No active class of whatever,
> but the real essence would help me a lot! :)
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


saveField() causes a SELECT COUNT(*)

2010-06-06 Thread Jake Moilanen
I have a very expensive background analytic process which is hammering
my database and I am wanting to reduce the unnecessary database calls
where ever I can.

I have a general log on my database and I noticed whenever the code
does a saveField() that first it tries getting the count on a primary
key (which should always be 1):

SELECT COUNT(*) AS `count` FROM `page_instances` AS `PageInstance`
WHERE `PageInstance`.`id` = 3214334
UPDATE `page_instances` SET `visible` = '0'  WHERE
`page_instances`.`id` = 3214334

I can do the UPDATE manually in my model and it avoids this SELECT
COUNT(*), but I was unsure if getting the count was for good reason.

Using version 1.2.6.

Thanks,
Jake

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@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