Re: A little complexed find()

2010-05-14 Thread Wang Still
Group hasMany GroupPost

User hasAndBelongsToMany Group

and i wanna  find all groupPosts from groups belongs to user

or maybe i can explain it this way :   aUser->groups->group_posts


On Sat, May 15, 2010 at 2:47 PM, still  wrote:

> Im having some difficulty on using find method in some complexed model
> relationships( its not so complexed in fact.).
> there are three models in my project : User Group and GroupPost
>
> User HABTM Group through a join table group_memberships ( i made a
> model for this table name GroupMembership).
>
> then im having a question about how can i find all GroupPosts those
> all from the Groups a User joined (have a membership in other word).
> I know i can find it by a sql query. but its a little bit ugly. can i
> doing this by a pretty model relationship based find method?
>
> can anyone help me ? thanks a lot !

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


A little complexed find()

2010-05-14 Thread still
Im having some difficulty on using find method in some complexed model
relationships( its not so complexed in fact.).
there are three models in my project : User Group and GroupPost

User HABTM Group through a join table group_memberships ( i made a
model for this table name GroupMembership).

then im having a question about how can i find all GroupPosts those
all from the Groups a User joined (have a membership in other word).
I know i can find it by a sql query. but its a little bit ugly. can i
doing this by a pretty model relationship based find method?

can anyone help me ? thanks a lot !

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


Cake tags

2010-05-14 Thread Ed Propsner
For most of you this is going to seem so trivial that it's almost laughable
so laugh if you must :)

I wanted to see how far I could make it through a site without using a
single standard  ... it's all cake.

All arguments aside, I think the gig is up.

[code]

foreach($photos as $photo)
{
echo ($i!= 0 && $i%$num_of_cols == 0)?'':'';
<--
echo $html->tag('td', null, array(  

[/code]

I can't find a way around it.

- Ed

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


Re: Display Blob from db

2010-05-14 Thread Ed Propsner
Funny you mention imagecreatefromstring(), it's the only one that does work
(and so it should) with binary straight from the db.

imagecreatefromjpeg() -> (png. etc.)
imagecreatetruecolor()
imagecopyresampled()
imagejpeg() -> (png. etc.)

all have their own set of issues. I went through (what seems like) the
entire GD library and got close but in the end it was just easier to write
to a file and work from there.

Although what I have works I'm still going to try your suggestions simply
because I never used them with cake yet and the whole point is to learn, not
just get by.

I'll keep ya' posted.

- Ed


On Fri, May 14, 2010 at 6:13 PM, calvin  wrote:

> Well, that's just how I would do it. If the other way works, and it's
> less work for you, then there's no need to change it. It's just
> natural for me to use RequestHandler since on most sites I already
> have it loaded for AJAX and RSS.
>
> As to manipulating images with PHP... I've only minimal experience
> with that. I guess it depends on which graphics library you're using.
> You could try GD's imagecreatefromstring() (
> http://us2.php.net/manual/en/function.imagecreatefromstring.php ).
>
> On May 14, 10:51 am, Ed Propsner  wrote:
> > Thanks Calvin, I'm still working on it trying to overcome other issues.
> I've
> > discovered that manipulating dynamically generated images using "blob" as
> > the base (original) image is next to impossible unless I'm missing
> something
> > which is extremely likely considering I don't know beans about it besides
> > the obvious (perhaps a tad more). I'm finding that I have to write the
> file
> > into a temp dir (which I'd rather not do), perform the manipulations,
> then
> > move into the db as blob. I was convinced I wouldn't need to do this and
> > spent forever trying not to but I was unable to find a work around
> (although
> > I got close). Using the temp dir is fine, I'm just stubborn :) (if you
> have
> > any ideas I'm all ears).
> >
> >  I didn't know any better when it came to Router::url, all I know is it
> > worked an that was fine for the time being (have a lot to learn with
> Cake).
> >
> > Router::parseExtensions() and $RequestHandler->setContent seem like they
> > will come in handy, I haven't looked into them yet. Even with pouring
> > through the API countless times there is just so much more available that
> I
> > was never aware of. Seems that most things really are a piece of "cake"
> as
> > long as your work with it instead of against it. Once I'm able to
> > confidently move, manipulate, and display images without any issues I'll
> > tweak everything to use "proper" conventions and clean up the mess some
> I'd
> > do it now but I'm already waist deep in this and it would feel a lot like
> > starting over :)
> >
> > I not sure why I was using $html->tag instead of $html->image in this
> > instance ... I do remember having issues in one area or another using
> 'blob'
> > with it but i can't remember what exactly at the moment. I do need to
> take
> > your advice though because $html->tag is becoming my new bad habit with
> > cake. When in doubt, it works with almost everything.
> >
> > I'll be starting to implement your suggestions later today so I'm sure
> I'll
> > more questions then.
> >
> > - Ed
> >
> > On Fri, May 14, 2010 at 1:05 PM, calvin 
> wrote:
> > > Wow, that was not nearly as well-formatted as I had hoped. Hope it's
> > > still comprehensible. In any case, the import parts are simply:
> > > 1. use Router::parseExtensions() to parse image extensions and pass
> > > them to $RequestHandler (perhaps define the extensions array as a
> > > model property to maintain DRY);
> > > 2. use $RequestHandler->setContent() to set the content-types for the
> > > various extensions
> > > 3. and I forgot to mention this in the previous post, but copy the
> > > ajax layout to /app/views/layout/image/default.ctp, and set $this-
> > > >layout = 'image' in the controller action;
> > > 4. create simple pass-thru view(s) (since they're all the same, you
> > > could just use something like $this->render('image') instead of
> > > Router::parseExtensions()'s default view locations);
> > > 5. use $html->image instead of $html->tag; it will accept both strings
> > > and arrays as image locations.
> >
> > > On May 14, 8:57 am, calvin  wrote:
> > > > Maybe I'm missing something here, but why is Router:url even needed?
> > > > The only thing you needed to do was to switch the layout to one
> > > > appropriate for displaying binary data (e.g. a blank layout like
> ajax)
> > > > and set debug to 0 to suppress the SQL output. All of this could have
> > > > been done by the RequestHandler component, e.g.:
> >
> > > > /**
> > > >  * In /app/config/routes.php:
> > > >  */
> > > > Router::parseExtensions('png', 'jpg', 'jpeg', 'svg');
> >
> > > > /**
> > > >  * In AppController:
> > > >  */
> > > > var $components = array('RequestHandler');
> >
> > > > /**
> > > >  * In AppController->beforeFilter():
> > > >  */
> > > >

Sorting using HABTM Join Table's additional field

2010-05-14 Thread ashok.b


Hello Cake Gurus, here's my problem:

Table1: Posts

id - int
title - varchar

Table2: Categories

id - int
name - varchar

HABTM JoinTable: categories_posts

id - int
post_id - int
category_id - int
postorder - int

As you can see, the join table contains a field called 'postorder' -
This is for ordering the posts in a particular category. For example,

Posts: Post1, Post2, Post3, Post4
Categories: Cat1, Cat2
Ordering:
 Cat1 - Post1, Post3, Post2
 Cat2 - Post3, Post1, Post4

Now in CakePHP,

$postpages = $this->Post->Category->find('all');

gives me a array like

Array
(
  [0] => Array
(
  [Category] => Array
(
  [id] => 13
  [name] => Cat1
)
[Post] => Array
(
  [0] => Array
  (
[id] => 1
[title] => Post2
[CategoriesPost] => Array
(
  [id] => 17
  [post_id] => 1
  [category_id] => 13
  [postorder] => 3
)
  )
  [1] => Array
  (
[id] => 4
[title] => Post1
[CategoriesPost] => Array
(
  [id] => 21
  [post_id] => 4
  [category_id] => 13
  [postorder] => 1
)
  )

)
)
)

As you can see [Post], they are not ordered according to
[CategoriesPost].postorder but are ordered according to
[CategoriesPost].id. How can I get the array ordered according to
[CategoriesPost].postorder?

The Queries from Cake's SQL Log are:

SELECT `Category`.`id`, `Category`.`name` FROM `categories` AS
`Category` WHERE 1 = 1

SELECT `Post`.`id`, `Post`.`title`, `CategoriesPost`.`id`,
`CategoriesPost`.`post_id`, `CategoriesPost`.`category_id`,
`CategoriesPost`.`postorder` FROM `posts` AS `Post` JOIN
`categories_posts` AS `CategoriesPost` ON
(`CategoriesPost`.`category_id` IN (13, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52) AND `CategoriesPost`.`post_id` = `Post`.`id`)

What I am looking for is how to make cake put a Order By
CategoriesPost.postorder in that second SELECT SQL Query.

Thanks in advance for your time :)

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


Re: Display Blob from db

2010-05-14 Thread calvin
Well, that's just how I would do it. If the other way works, and it's
less work for you, then there's no need to change it. It's just
natural for me to use RequestHandler since on most sites I already
have it loaded for AJAX and RSS.

As to manipulating images with PHP... I've only minimal experience
with that. I guess it depends on which graphics library you're using.
You could try GD's imagecreatefromstring() (
http://us2.php.net/manual/en/function.imagecreatefromstring.php ).

On May 14, 10:51 am, Ed Propsner  wrote:
> Thanks Calvin, I'm still working on it trying to overcome other issues. I've
> discovered that manipulating dynamically generated images using "blob" as
> the base (original) image is next to impossible unless I'm missing something
> which is extremely likely considering I don't know beans about it besides
> the obvious (perhaps a tad more). I'm finding that I have to write the file
> into a temp dir (which I'd rather not do), perform the manipulations, then
> move into the db as blob. I was convinced I wouldn't need to do this and
> spent forever trying not to but I was unable to find a work around (although
> I got close). Using the temp dir is fine, I'm just stubborn :) (if you have
> any ideas I'm all ears).
>
>  I didn't know any better when it came to Router::url, all I know is it
> worked an that was fine for the time being (have a lot to learn with Cake).
>
> Router::parseExtensions() and $RequestHandler->setContent seem like they
> will come in handy, I haven't looked into them yet. Even with pouring
> through the API countless times there is just so much more available that I
> was never aware of. Seems that most things really are a piece of "cake" as
> long as your work with it instead of against it. Once I'm able to
> confidently move, manipulate, and display images without any issues I'll
> tweak everything to use "proper" conventions and clean up the mess some I'd
> do it now but I'm already waist deep in this and it would feel a lot like
> starting over :)
>
> I not sure why I was using $html->tag instead of $html->image in this
> instance ... I do remember having issues in one area or another using 'blob'
> with it but i can't remember what exactly at the moment. I do need to take
> your advice though because $html->tag is becoming my new bad habit with
> cake. When in doubt, it works with almost everything.
>
> I'll be starting to implement your suggestions later today so I'm sure I'll
> more questions then.
>
> - Ed
>
> On Fri, May 14, 2010 at 1:05 PM, calvin  wrote:
> > Wow, that was not nearly as well-formatted as I had hoped. Hope it's
> > still comprehensible. In any case, the import parts are simply:
> > 1. use Router::parseExtensions() to parse image extensions and pass
> > them to $RequestHandler (perhaps define the extensions array as a
> > model property to maintain DRY);
> > 2. use $RequestHandler->setContent() to set the content-types for the
> > various extensions
> > 3. and I forgot to mention this in the previous post, but copy the
> > ajax layout to /app/views/layout/image/default.ctp, and set $this-
> > >layout = 'image' in the controller action;
> > 4. create simple pass-thru view(s) (since they're all the same, you
> > could just use something like $this->render('image') instead of
> > Router::parseExtensions()'s default view locations);
> > 5. use $html->image instead of $html->tag; it will accept both strings
> > and arrays as image locations.
>
> > On May 14, 8:57 am, calvin  wrote:
> > > Maybe I'm missing something here, but why is Router:url even needed?
> > > The only thing you needed to do was to switch the layout to one
> > > appropriate for displaying binary data (e.g. a blank layout like ajax)
> > > and set debug to 0 to suppress the SQL output. All of this could have
> > > been done by the RequestHandler component, e.g.:
>
> > > /**
> > >  * In /app/config/routes.php:
> > >  */
> > > Router::parseExtensions('png', 'jpg', 'jpeg', 'svg');
>
> > > /**
> > >  * In AppController:
> > >  */
> > > var $components = array('RequestHandler');
>
> > > /**
> > >  * In AppController->beforeFilter():
> > >  */
> > > $this->RequestHandler->setContent('png', 'image/png');
> > > $this->RequestHandler->setContent('jpg', 'image/jpeg');
> > > $this->RequestHandler->setContent('jpeg', 'image/jpeg');
> > > $this->RequestHandler->setContent('svg', 'image/svg+xml');
>
> > > /**
> > >  * In ImagesController->view():
> > >  */
> > > $ext = $this->RequestHandler->ext;
> > > $exts = array('png', 'jpg', 'jpeg', 'svg');
> > > if(in_array($ext, $exts)){
> > >     $filename = "$id.$ext";
> > >     $image = $this->Image->findByFilename($filename);} else {
>
> > >     // regular view action
> > >     if (!$id) {
> > >         $this->Session->setFlash(sprintf(__('Invalid %s', true),
> > > 'image'));
> > >         $this->redirect(array('action' => 'index'));
> > >     }
> > >     $image = $this->Image->read(null, $id);}
>
> > > $this->set(compact('image'));
> > > /**
> > >  * C

Re: How to handle multiple user types

2010-05-14 Thread Eric Anderson
I have a "parties" table as well.

On May 14, 3:17 am, Zaky Katalan-Ezra  wrote:
> What is the other tables?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Re: 2 models in one view

2010-05-14 Thread bradmaxs
Thank you Zaky.  Makes perfect sense.

On May 14, 12:28 pm, Zaky Katalan-Ezra  wrote:
> As you can see from the cookbook
> profile.user_id should define hasOne and post.user_id should define hasMany.
> There is no way the "./cake bake all" can distinguish these two so by
> default its hasMany.
> If you want to define hasOne set it manually or bake the model step by step
> and choose user hasOne reference.
>
> I think that if you defined a unique index on profile.user_id and aforeign
> key cake should use hasOne.
> But it doesn't.
>
>
>
> On Fri, May 14, 2010 at 8:55 PM, bradmaxs  wrote:
> > Thank you both for your responses.
>
> > I ended up changing the association, cleared my cache and it works
> > like a charm.
>
> > Quick question. I used the command line to bake everything.  The
> > user_preference table has user_id in it for the association.
>
> > Why did bake make it a hasMany association rather than hasOne? Did I
> > miss something when I baked the models?
>
> > Thanks again.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> Regards,
> Zaky Katalan-Ezra
> QA Administratorwww.IGeneriX.com
> Sites.IGeneriX.com
> 054-7762312
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Re: 2 models in one view

2010-05-14 Thread Zaky Katalan-Ezra
As you can see from the cookbook
profile.user_id should define hasOne and post.user_id should define hasMany.
There is no way the "./cake bake all" can distinguish these two so by
default its hasMany.
If you want to define hasOne set it manually or bake the model step by step
and choose user hasOne reference.

I think that if you defined a unique index on profile.user_id and aforeign
key cake should use hasOne.
But it doesn't.


On Fri, May 14, 2010 at 8:55 PM, bradmaxs  wrote:

> Thank you both for your responses.
>
> I ended up changing the association, cleared my cache and it works
> like a charm.
>
> Quick question. I used the command line to bake everything.  The
> user_preference table has user_id in it for the association.
>
> Why did bake make it a hasMany association rather than hasOne? Did I
> miss something when I baked the models?
>
> Thanks again.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Regards,
Zaky Katalan-Ezra
QA Administrator
www.IGeneriX.com
Sites.IGeneriX.com
054-7762312

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


Re: 2 models in one view

2010-05-14 Thread bradmaxs
Thank you both for your responses.

I ended up changing the association, cleared my cache and it works
like a charm.

Quick question. I used the command line to bake everything.  The
user_preference table has user_id in it for the association.

Why did bake make it a hasMany association rather than hasOne? Did I
miss something when I baked the models?

Thanks again.

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


Re: Display Blob from db

2010-05-14 Thread Ed Propsner
Thanks Calvin, I'm still working on it trying to overcome other issues. I've
discovered that manipulating dynamically generated images using "blob" as
the base (original) image is next to impossible unless I'm missing something
which is extremely likely considering I don't know beans about it besides
the obvious (perhaps a tad more). I'm finding that I have to write the file
into a temp dir (which I'd rather not do), perform the manipulations, then
move into the db as blob. I was convinced I wouldn't need to do this and
spent forever trying not to but I was unable to find a work around (although
I got close). Using the temp dir is fine, I'm just stubborn :) (if you have
any ideas I'm all ears).

 I didn't know any better when it came to Router::url, all I know is it
worked an that was fine for the time being (have a lot to learn with Cake).

Router::parseExtensions() and $RequestHandler->setContent seem like they
will come in handy, I haven't looked into them yet. Even with pouring
through the API countless times there is just so much more available that I
was never aware of. Seems that most things really are a piece of "cake" as
long as your work with it instead of against it. Once I'm able to
confidently move, manipulate, and display images without any issues I'll
tweak everything to use "proper" conventions and clean up the mess some I'd
do it now but I'm already waist deep in this and it would feel a lot like
starting over :)

I not sure why I was using $html->tag instead of $html->image in this
instance ... I do remember having issues in one area or another using 'blob'
with it but i can't remember what exactly at the moment. I do need to take
your advice though because $html->tag is becoming my new bad habit with
cake. When in doubt, it works with almost everything.

I'll be starting to implement your suggestions later today so I'm sure I'll
more questions then.

- Ed


On Fri, May 14, 2010 at 1:05 PM, calvin  wrote:

> Wow, that was not nearly as well-formatted as I had hoped. Hope it's
> still comprehensible. In any case, the import parts are simply:
> 1. use Router::parseExtensions() to parse image extensions and pass
> them to $RequestHandler (perhaps define the extensions array as a
> model property to maintain DRY);
> 2. use $RequestHandler->setContent() to set the content-types for the
> various extensions
> 3. and I forgot to mention this in the previous post, but copy the
> ajax layout to /app/views/layout/image/default.ctp, and set $this-
> >layout = 'image' in the controller action;
> 4. create simple pass-thru view(s) (since they're all the same, you
> could just use something like $this->render('image') instead of
> Router::parseExtensions()'s default view locations);
> 5. use $html->image instead of $html->tag; it will accept both strings
> and arrays as image locations.
>
> On May 14, 8:57 am, calvin  wrote:
> > Maybe I'm missing something here, but why is Router:url even needed?
> > The only thing you needed to do was to switch the layout to one
> > appropriate for displaying binary data (e.g. a blank layout like ajax)
> > and set debug to 0 to suppress the SQL output. All of this could have
> > been done by the RequestHandler component, e.g.:
> >
> > /**
> >  * In /app/config/routes.php:
> >  */
> > Router::parseExtensions('png', 'jpg', 'jpeg', 'svg');
> >
> > /**
> >  * In AppController:
> >  */
> > var $components = array('RequestHandler');
> >
> > /**
> >  * In AppController->beforeFilter():
> >  */
> > $this->RequestHandler->setContent('png', 'image/png');
> > $this->RequestHandler->setContent('jpg', 'image/jpeg');
> > $this->RequestHandler->setContent('jpeg', 'image/jpeg');
> > $this->RequestHandler->setContent('svg', 'image/svg+xml');
> >
> > /**
> >  * In ImagesController->view():
> >  */
> > $ext = $this->RequestHandler->ext;
> > $exts = array('png', 'jpg', 'jpeg', 'svg');
> > if(in_array($ext, $exts)){
> > $filename = "$id.$ext";
> > $image = $this->Image->findByFilename($filename);} else {
> >
> > // regular view action
> > if (!$id) {
> > $this->Session->setFlash(sprintf(__('Invalid %s', true),
> > 'image'));
> > $this->redirect(array('action' => 'index'));
> > }
> > $image = $this->Image->read(null, $id);}
> >
> > $this->set(compact('image'));
> > /**
> >  * Create (or just create one and make the rest symbolic links):
> >  * /app/views/images/png/view.ctp
> >  * /app/views/images/jpg/view.ctp
> >  * /app/views/images/jpeg/view.ctp
> >  * /app/views/images/svg/view.ctp
> >  * with:
> >  */
> > echo $image['blob_file'];
> >
> > /**
> >  * To display an image on a page, just use:
> >  */
> > echo $html->image('/images/view/'.$userInfo['Photo'][0]['filename'],
> > array('alt' => $userInfo['Photo'][0]['caption']))?>
> > // $html->image() also takes arrays as the image path; no need for
> > Router::url(), which, by the way, you can also call simply by $this-
> >
> > >url().
> >
> > Though, I think the media view should have a way of outp

Change find type for contained model and other questions

2010-05-14 Thread ramonmaruko
I have the following model associations:

Response->Survey
Response->Question
Response->Choice
Survey->Question
Question->Choice

I want to create a form where I could answer all the questions for one
survey. So I used the following to return the needed data:

$questions = $this->Response->Question->find('all',
array(
 'conditions' => array('survey_id' =>
$id),
 'contain' =>
array('Choice')
)
);

Sample debug($questions) is at http://pastebin.com/AL6kNjnC

Questions:

(1) What should I do so that the Choice index returns a find('list')
format e.g. http://pastebin.com/mMASg1HY so that I could do:

foreach($question as $questions) {
$this->Form->select('0.question', $question['Choice']);
}

(2) Is there any way to just use $this->Form->input() to automagically
create the multiple select fields for the Question->Choice combo?

e.g.

(1) What is your name?
   |-||
   |Marco||
   |-||
   |Marie ||
   |Myka ||
   |-||

(2) Babs si Marie?
   |-||
   |Yes   ||
   |-||
   |No ||
   |-||

FWIW, I have $recursion = -1 in my AppModel.

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


Beginner: Blog Example

2010-05-14 Thread Sze Chan
Environment:
PHP v5.2.13
MySQL 5.0.51a

Hello everybody,

I followed the Blog Tutorial lesson using CakePHP v1.3.  One question
remains after I went through this tutorial.

I can Add a Blog Post, but I cannot Delete or Edit Blog Posts.  Am I
missing something?

Thanks,

Sze

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


Re: Display Blob from db

2010-05-14 Thread calvin
Wow, that was not nearly as well-formatted as I had hoped. Hope it's
still comprehensible. In any case, the import parts are simply:
1. use Router::parseExtensions() to parse image extensions and pass
them to $RequestHandler (perhaps define the extensions array as a
model property to maintain DRY);
2. use $RequestHandler->setContent() to set the content-types for the
various extensions
3. and I forgot to mention this in the previous post, but copy the
ajax layout to /app/views/layout/image/default.ctp, and set $this-
>layout = 'image' in the controller action;
4. create simple pass-thru view(s) (since they're all the same, you
could just use something like $this->render('image') instead of
Router::parseExtensions()'s default view locations);
5. use $html->image instead of $html->tag; it will accept both strings
and arrays as image locations.

On May 14, 8:57 am, calvin  wrote:
> Maybe I'm missing something here, but why is Router:url even needed?
> The only thing you needed to do was to switch the layout to one
> appropriate for displaying binary data (e.g. a blank layout like ajax)
> and set debug to 0 to suppress the SQL output. All of this could have
> been done by the RequestHandler component, e.g.:
>
> /**
>  * In /app/config/routes.php:
>  */
> Router::parseExtensions('png', 'jpg', 'jpeg', 'svg');
>
> /**
>  * In AppController:
>  */
> var $components = array('RequestHandler');
>
> /**
>  * In AppController->beforeFilter():
>  */
> $this->RequestHandler->setContent('png', 'image/png');
> $this->RequestHandler->setContent('jpg', 'image/jpeg');
> $this->RequestHandler->setContent('jpeg', 'image/jpeg');
> $this->RequestHandler->setContent('svg', 'image/svg+xml');
>
> /**
>  * In ImagesController->view():
>  */
> $ext = $this->RequestHandler->ext;
> $exts = array('png', 'jpg', 'jpeg', 'svg');
> if(in_array($ext, $exts)){
>     $filename = "$id.$ext";
>     $image = $this->Image->findByFilename($filename);} else {
>
>     // regular view action
>     if (!$id) {
>         $this->Session->setFlash(sprintf(__('Invalid %s', true),
> 'image'));
>         $this->redirect(array('action' => 'index'));
>     }
>     $image = $this->Image->read(null, $id);}
>
> $this->set(compact('image'));
> /**
>  * Create (or just create one and make the rest symbolic links):
>  * /app/views/images/png/view.ctp
>  * /app/views/images/jpg/view.ctp
>  * /app/views/images/jpeg/view.ctp
>  * /app/views/images/svg/view.ctp
>  * with:
>  */
> echo $image['blob_file'];
>
> /**
>  * To display an image on a page, just use:
>  */
> echo $html->image('/images/view/'.$userInfo['Photo'][0]['filename'],
> array('alt' => $userInfo['Photo'][0]['caption']))?>
> // $html->image() also takes arrays as the image path; no need for
> Router::url(), which, by the way, you can also call simply by $this-
>
> >url().
>
> Though, I think the media view should have a way of outputting files
> from the database or binary data directly passed to it.
>
> On May 12, 9:42 pm, Ed Propsner  wrote:
>
>
>
> > Thanks Martin, it worked just fine.
>
> > It turns out that with all I have tried I was actually close.
>
> > $this->layout = 'ajax'
> > AND
> > Router::url
>
> > made all the difference in the world.
>
> > I nearly fell out of my chair when the image displayed :)
>
> > - Ed
>
> > On Wed, May 12, 2010 at 11:54 PM, Martin Radosta 
> > wrote:
>
> > >  An approach
>
> > > in the controller:
>
> > > function show_image($recordId) {
> > >     $this->set('data', $this->Model->findById($recordId));
> > >     $this->layout = 'ajax'
> > > }
>
> > > the view show_image.ctp:
>
> > > Configure::write('debug', 0);
> > > header("Content-type: image/jpeg"); //assume jpg image
> > > echo $data['Model']['blob_file'];
>
> > > your view:
>
> > > echo $html->tag('img', array(
> > >     'src' => Router::url(array('controller' => 'your_controller', 'action'
> > > => 'show_image', $userInfo['Photo'][0]['id']))
> > >     )
> > > );
>
> > > Regards
>
> > > MARTIN
>
> > > On 05/13/2010 12:26 AM, Ed Propsner wrote:
>
> > > Besides the size there should be no diff between "binary" and "blob", I 
> > > was
> > > just thinking that perhaps Cake handled them differently.
> > > I played around with media view and it doesn't seem to be what I'm looking
> > > for.
>
> > >  I have it narrowed down to the headers and I can get the photo to display
> > > but it has to be in it's own view and even then I have to echo the image
> > > directly in the controller action ... this isn't working for me. I never
> > > usually store photos directly to the database but in this instance i feel 
> > > it
> > > better serves my purpose without taking a hit on performance.
>
> > >  Ideally I would like to access the image through it's $hasMany assoc and
> > > nest it in an image tag but I'm at a loss for how to pull that off with
> > > Cake.
>
> > > On Wed, May 12, 2010 at 3:12 PM, Ed Propsner  wrote:
>
> > >> I've been toying with this one for a while now and I'm not really getting
> > >> anywhere.
>
> > >> 

Re: Calling controller from view Vs using define

2010-05-14 Thread Miles J
What kind of data are you passing?

Just place this in your AppControllers::beforeFender();

$this->set('var', $this->myFunc());

On May 14, 4:56 am, Mandy Singh  wrote:
> Hi Everyone,
>
> Quick question:
>
> I need to get something in the view (all views) for which I have a
> function defined in the app_controller.
>
> So, what I want to know is what is more efficient?
>
> 1. Calling $this->controller->myFun() from the view (of course it
> beats the MVC model)
>
> 2. Using define() and setting it as a constant through
> app_controller ?
>
> I read that define() is an expensive call. I am not killing my self
> over over-optimization but thought it would be nice to know if
> define() is an expensive call.
>
> Thanks,
> Mandy
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Re: Finding related articles

2010-05-14 Thread calvin
I completely agree, both with the point about it being difficult to
use Cake for advanced applications (or just non-standard CRUD sites)
without prior knowledge of SQL, and about not picking up bad habits by
developing within an MVC framework from the get-go.

Personally, I'm not as familiar with SQL as I'd like to be either
(don't know how to use triggers, stored procedures, build indexes,
create constraints, etc.), even though I've been developing with it
for over 7 years, as I've never taken a formal course on database
design/development/administration. But I have the dev.mysql.com (as
well as php.net, jquery.com, Cake API/Cookbook, MDC, etc.) search tool
install with search keywords configured so that I can just type "mysql
distinct" into the Firefox address bar, and it will search the online
MySQL documentation for the DISTINCT keyword--it doesn't work quite as
well as php.net's search function, which will automatically take you
to the page for that function/class/topic, but it still saves me a lot
of time since I'm looking up stuff in the MySQL manual all day long.

MySQL's online documentation can be quite dense at times, as it also
assumes that you have formal training in SQL and relational databases,
but the user comments are pretty helpful and often includes example
code. But the best way to learn (aside from taking an academic course)
is just to practice writing lots of MySQL queries using the command-
line client or write practice PHP+MySQL apps using manual queries
instead of Cake's model functions. You should do this at least until
you're proficient enough in SQL that you can write your Cake
application without the use of Cake's database abstraction (e.g. know
how to use SELECT, INSERT, UPDATE, DELETE, as well as basic uses of
joins and even subqueries). Once you've done that, then you can let
Cake handle most of the menial queries and use GUI clients to
administer your database.

On May 11, 11:56 pm, WebbedIT  wrote:
> It is going to be a little more difficult for you coming to this
> without any prior knowledge of databases.  However, I wish I had
> worked within the constraints of this framework (OOP/MVC Design
> Pattern) before I had the chance to teach myself a lot of bad habits
> so you have that going for you.
>
> Whilst book.cakephp.org does mention the use of DISTINCT and GROUP
> etc. it is likely to cover them as if you already know what they do.
> It may be worthwhile reading through some MySQL tutorials (I assume
> you're using MySQL) just to get your head around the possibilities
> open to you.
>
> I have never read through a tutorial from start to finish but a quick
> Google found this one which seems to cover most of the functions:
>
> http://www.tizag.com/mysqlTutorial/
>
> someone else may be able to recommend a better one though.
>
> HTH
>
> Paul.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Re: drop down. elements are not storing.... in to the table..

2010-05-14 Thread calvin
By the way, the CakePHP inflector class knows how to inflect
"agencies" to "agency" and vice versa; no need to use silly made-up
words like "agencie".

On May 11, 9:43 pm, Ambika Kulkarni 
wrote:
> In your view file put the below code n check
>
>  e($form->select('agencyId',
>
>
>
> >                            array(
> >                            'empty' => '-All Suppliers-',
> >                            $agencies),
> >                            null,
> >                            array(
> >                            'id' => 'agency_id',
> >                            'style' => 'width: 50%'),false));
> On Tue, May 11, 2010 at 1:57 PM, Master Ram  wrote:
> > hi.. all
>
> > i am new to cakePHP.
>
> > my table name is : promoters
>
> > in this table i have many tables. when i am selecting the element form
> > the drop down. in the table only storing "0". when i am changing my
> > option also it is storing "0" only..
>
> > this is my. controller code:
>
> > function promoter(){
>
> >        //get all data from supplier table
> >       $agencies = $this->Agencie->find('list',
> >                                           array(
> >                                           'fields' =>
> > array('agency_id','name'),
> >                                                            'order' =>
> >                                                            array(
>
> >                                                                'name
> > ASC')));
>
> >        $this->set('agencies',$agencies);
>
> >        $demographics = $this->Demographic->find('all');
>
> >        $this->set('demographics', $demographics);
>
> >        if (!empty($this->data)) {
>
> >            $this->Promoter->create();
>
> >            $this->data['Promoter']['agency_id'];
>
> >            $this->data['Promoter']['name'];
>
> >            $this->data['Promoter']['last_name'];
>
> >            $this->data['Promoter']['surname'];
>
> >            $this->data['Promoter']['id_no'];
>
> >            $this->data['Promoter']['cell'];
>
> >            $this->Promoter->save($this->data);
>
> >            $this->Session->setFlash('The User has been registered,
> > please login');
>
> >            $this->redirect(array('action'=>'promoters_step_two'));
>
> >        }
>
> >    }
>
> > this is my view code:
>
> >  >                    e($form->select('agencie_agencyId',
> >                            array(
> >                            'empty' => '-All Suppliers-',
> >                            $agencies),
> >                            null,
> >                            array(
> >                            'id' => 'agency_id',
> >                            'style' => 'width: 50%'),false));
> >                ?>
>
> > table fiels is: agency_id.
>
> > please help me. where i am missing. in this code...
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Re: Display Blob from db

2010-05-14 Thread calvin
Maybe I'm missing something here, but why is Router:url even needed?
The only thing you needed to do was to switch the layout to one
appropriate for displaying binary data (e.g. a blank layout like ajax)
and set debug to 0 to suppress the SQL output. All of this could have
been done by the RequestHandler component, e.g.:

/**
 * In /app/config/routes.php:
 */
Router::parseExtensions('png', 'jpg', 'jpeg', 'svg');

/**
 * In AppController:
 */
var $components = array('RequestHandler');

/**
 * In AppController->beforeFilter():
 */
$this->RequestHandler->setContent('png', 'image/png');
$this->RequestHandler->setContent('jpg', 'image/jpeg');
$this->RequestHandler->setContent('jpeg', 'image/jpeg');
$this->RequestHandler->setContent('svg', 'image/svg+xml');

/**
 * In ImagesController->view():
 */
$ext = $this->RequestHandler->ext;
$exts = array('png', 'jpg', 'jpeg', 'svg');
if(in_array($ext, $exts)){
$filename = "$id.$ext";
$image = $this->Image->findByFilename($filename);
} else {
// regular view action
if (!$id) {
$this->Session->setFlash(sprintf(__('Invalid %s', true),
'image'));
$this->redirect(array('action' => 'index'));
}
$image = $this->Image->read(null, $id);
}
$this->set(compact('image'));
/**
 * Create (or just create one and make the rest symbolic links):
 * /app/views/images/png/view.ctp
 * /app/views/images/jpg/view.ctp
 * /app/views/images/jpeg/view.ctp
 * /app/views/images/svg/view.ctp
 * with:
 */
echo $image['blob_file'];

/**
 * To display an image on a page, just use:
 */
echo $html->image('/images/view/'.$userInfo['Photo'][0]['filename'],
array('alt' => $userInfo['Photo'][0]['caption']))?>
// $html->image() also takes arrays as the image path; no need for
Router::url(), which, by the way, you can also call simply by $this-
>url().

Though, I think the media view should have a way of outputting files
from the database or binary data directly passed to it.

On May 12, 9:42 pm, Ed Propsner  wrote:
> Thanks Martin, it worked just fine.
>
> It turns out that with all I have tried I was actually close.
>
> $this->layout = 'ajax'
> AND
> Router::url
>
> made all the difference in the world.
>
> I nearly fell out of my chair when the image displayed :)
>
> - Ed
>
> On Wed, May 12, 2010 at 11:54 PM, Martin Radosta 
> wrote:
>
>
>
> >  An approach
>
> > in the controller:
>
> > function show_image($recordId) {
> >     $this->set('data', $this->Model->findById($recordId));
> >     $this->layout = 'ajax'
> > }
>
> > the view show_image.ctp:
>
> > Configure::write('debug', 0);
> > header("Content-type: image/jpeg"); //assume jpg image
> > echo $data['Model']['blob_file'];
>
> > your view:
>
> > echo $html->tag('img', array(
> >     'src' => Router::url(array('controller' => 'your_controller', 'action'
> > => 'show_image', $userInfo['Photo'][0]['id']))
> >     )
> > );
>
> > Regards
>
> > MARTIN
>
> > On 05/13/2010 12:26 AM, Ed Propsner wrote:
>
> > Besides the size there should be no diff between "binary" and "blob", I was
> > just thinking that perhaps Cake handled them differently.
> > I played around with media view and it doesn't seem to be what I'm looking
> > for.
>
> >  I have it narrowed down to the headers and I can get the photo to display
> > but it has to be in it's own view and even then I have to echo the image
> > directly in the controller action ... this isn't working for me. I never
> > usually store photos directly to the database but in this instance i feel it
> > better serves my purpose without taking a hit on performance.
>
> >  Ideally I would like to access the image through it's $hasMany assoc and
> > nest it in an image tag but I'm at a loss for how to pull that off with
> > Cake.
>
> > On Wed, May 12, 2010 at 3:12 PM, Ed Propsner  wrote:
>
> >> I've been toying with this one for a while now and I'm not really getting
> >> anywhere.
>
> >>  I'm trying to display a photo stored in db as type "blob". With
> >> conventional PHP I would normally store the photo with type "binary" and
> >> never had any issues ... Blob is not going so well.
> >> I figure the problem has something to do with content type but MVC is
> >> confusing me a bit when it comes to headers or media views. It seems
> >> straightforward enough but I think I'm going about the wrong way (I'm not
> >> using media view or headers at this point).
>
> >>  In my Users Model I set up a $hasMany assoc.
>
> >>   var $hasMany = array(
> >>         'Photo' => array(
> >>             'className'     => 'Photo',
> >>             'foreignKey'    => 'user_id',
> >>             'conditions'    => array('Photo.profile' => 1, 'Photo.private'
> >> => 0),
> >>             'limit'        => '1',
> >>             'dependent'=> true
> >>         )
> >>     );
>
> >>  Rendering the photo is the problem.
>
> >>  > View
>
> >>  $html->tag('img', array(
> >>                                   'src' => $userInfo['Photo'][0]['file']
> >>                                  )
> >>                 )
>
> >> 

Re: Automatically select a subset of a model's fields

2010-05-14 Thread Michele Ferri
Thanks. Now I gotta figure out how to limit the fields stored in
session by the Auth component, and I'm set.

On May 12, 11:46 pm, "WoJo&Co"  wrote:
> Hi,
>
> In your associations you can name the fields that Cake retrieves in
> the model associations - something like:
>
> var $belongsTo = array(
> 'User' => array(
> 'className' => 'User',
> 'foreignKey' => 'user_id',
> 'fields' => array(
> 'User.id', 'User.email', 'etc', 'etc'),
> )
> );
>
> Is the basic structure that will do the trick for you.
>
> John
>
> On May 12, 1:11 pm, Michele Ferri  wrote:
>
>
>
> > Hi.
>
> > In my web app I am bridging with PHPBB for user authentication, so my
> > main user database table is PHPBB's user table. I created a Cake model
> > for it.
> > The problem is, lots of tables in my app join with the user table,
> > which has a lot of fields related to PHPBB stuff, but I only really
> > need the user id, name and email. Cake fetches all the fields
> > everytime.
> > Is there a way to specify a subset of fields to select, without having
> > to add everytime a 'fields' option in the queries? I tried with the
> > $_schema property but to no avail.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Re: Model::saveAll wont save associated data

2010-05-14 Thread designv...@gmail.com
IIRC I dont think you can do saveAll past 2 levels.

d.

On May 14, 2:52 pm, antte  wrote:
> I have Registrations which hasMany Invoices which hasMany Items and so
> im trying to saveAll (from the registration model) this data:
>
> Array (
>   [Registration] => Array(
>     [event_id] => 7
>     [number] => S4D3A2
>   )
>   [Invoice] => Array(
>     [0] => Array(
>       [expiry_date] => 2010-06-13 13:29:14
>       [Item] => Array(
>         [0] => Array(
>           [price] => 455.5
>           [description] => blabla
>         )
>         [1] => Array(
>           [price] => 455.5
>           [description] => blabla2
>         )
>       )
>     )
>   )
> )
>
> The save just stops after Invoice.
>
> Yes, i have the right associations both ways.
> Yes, all my tables and fields are named correctly.
>
> Can anybody save me?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Re: application accidentally logs out

2010-05-14 Thread designv...@gmail.com
Check your security settings in 'core.php'

And read this: 
http://book.cakephp.org/view/42/The-Configuration-Class#CakePHP-Core-Configuration-Variables-44

Note: "CakePHP session IDs are also regenerated between requests if
'Security.level' is set to 'high'. "


d.

On May 14, 9:09 am, snicky  wrote:
> Sometimes during going to next page in browser
> , cake logs out.
>
> Are there any possibly causes of that?
>
> I use session in order to keep user data, also generate password
> manually and i check if form data is equal to that username and
> password from...
>
> Regards
> Pacior
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Model::saveAll wont save associated data

2010-05-14 Thread antte
I have Registrations which hasMany Invoices which hasMany Items and so
im trying to saveAll (from the registration model) this data:

Array (
  [Registration] => Array(
[event_id] => 7
[number] => S4D3A2
  )
  [Invoice] => Array(
[0] => Array(
  [expiry_date] => 2010-06-13 13:29:14
  [Item] => Array(
[0] => Array(
  [price] => 455.5
  [description] => blabla
)
[1] => Array(
  [price] => 455.5
  [description] => blabla2
)
  )
)
  )
)

The save just stops after Invoice.

Yes, i have the right associations both ways.
Yes, all my tables and fields are named correctly.

Can anybody save me?

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


Javascript form validation in cakephp 1.3.0

2010-05-14 Thread Nandan Jana
Hi,

  I am a php developer and i never use a frame work. Nowaday's
frame work is must . so i search a lot in google and decided to use
CAKEPHP.

  I am using the latest stable version 1.3.0 , Try to develope a
admin panel first and i have learned a lot about model, controller,
layout, elements . I have developed a login panel , session
management, template partition using elements . and  now working for
to complete a full control panel.

 i have used validation rules in the model class and the form is
validated by server side.BUT

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


application accidentally logs out

2010-05-14 Thread snicky
Sometimes during going to next page in browser
, cake logs out.

Are there any possibly causes of that?

I use session in order to keep user data, also generate password
manually and i check if form data is equal to that username and
password from...

Regards
Pacior

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


Re: Currently logged user in Cake 1.3 Final

2010-05-14 Thread Ernesto
found it!
lol :D

On 14 Mag, 15:26, AD7six  wrote:
> On May 14, 3:18 pm, Ernesto  wrote:
>
> > i mean "display information about 'me' when I am logged in" :)
>
> > sry for my engRish lol
>
> > btw i pr'ed $this->Auth from one of my controllers but there's no
> > "User" var listed...
>
> not surprising given it's a method. Try pr-ing over to the api ;)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Re: Currently logged user in Cake 1.3 Final

2010-05-14 Thread AD7six


On May 14, 3:18 pm, Ernesto  wrote:
> i mean "display information about 'me' when I am logged in" :)
>
> sry for my engRish lol
>
> btw i pr'ed $this->Auth from one of my controllers but there's no
> "User" var listed...

not surprising given it's a method. Try pr-ing over to the api ;)

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


Re: Currently logged user in Cake 1.3 Final

2010-05-14 Thread Ernesto
i mean "display information about 'me' when I am logged in" :)

sry for my engRish lol

btw i pr'ed $this->Auth from one of my controllers but there's no
"User" var listed...

On 14 Mag, 14:54, Jeremy Burns  wrote:
> Do you mean 'get all currently logged in users' (i.e. from a central server 
> based admin point of view) or display information about 'me' when I am logged 
> in? The latter is achieved by looking inside $this->Auth->user();
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 14 May 2010, at 13:51, Ernesto wrote:
>
> > Hello.
>
> > is there any way to retrieve the currently logged user in CakePHP 1.3?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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


Re: Currently logged user in Cake 1.3 Final

2010-05-14 Thread Jeremy Burns
Do you mean 'get all currently logged in users' (i.e. from a central server 
based admin point of view) or display information about 'me' when I am logged 
in? The latter is achieved by looking inside $this->Auth->user();

Jeremy Burns
jeremybu...@me.com


On 14 May 2010, at 13:51, Ernesto wrote:

> Hello.
> 
> is there any way to retrieve the currently logged user in CakePHP 1.3?
> 
> 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

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


Currently logged user in Cake 1.3 Final

2010-05-14 Thread Ernesto
Hello.

is there any way to retrieve the currently logged user in CakePHP 1.3?

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


Helper elements

2010-05-14 Thread Grzegorz Pawlik
I have an idea I want to to share with You.

I made some fancy element called list (http://bin.cakephp.org/view/
127456247). The implementation is not that important, it's just
foreach You always do when listing stuff from db (putting them into tr/
td, marking odd tr's, adding some links at the end and so).

Now, as You could see in the code - there are Two functions defined to
make code below more clear. But what concerns me is that I'm not
protected from possible function names conflicts.

Since I cannot add my function into a namespace like MyApp\Views
\Elements\List (because I cannot be sure if my php version is 5.3) so
i thougt about changing it into a helper. It seemed like a good idea
until I saw (in my mind) this whole html in php strings - that sucks a
lot.

I thought about new feature: Helper elements - elements that are owned
by Helpers.

Check this out.

I make helper in a new way:
/views/helpers/list/list.php
class ListHelper extends Helper() {
  function doSth(){
 // some code, preparing structures
 $this->renderHelperElement("my_element");
  }

   function doSomethingUsefull($param) {
 return array("foo"=>$param);
   }
}

and then I can define
/views/helpers/list/my_element.ctp
// bunch of html
doSomethingUsefull("bar"); ?>
 $v): ?>
//


Good points are that we can make better separation between data
manipulation and representation.
Problem could be ciclick dependency between Helper and his elements.

Is that description clear for You? What do You think about it cake-
friends?

Thanks for Your time.
Grzegorz

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


Re: Dealing with forms!!!!!

2010-05-14 Thread sherzo

Hi Paul

Thanks for the useful link. Actually I was using the Thickbox and Jquery,
but after visiting your blog I decided to use the Modalbox.
Unfortunately I couldnt manage to open a modal box!!! i opens the view into
a new window instead of a modal box!!

I added all the javascript links and css to my application

and use used: 

link('Login',array('action' => 'users/login'),array('title' =>
'Customer details','onclick' => "Modalbox.show(this.href, {title:
this.title, width: 400}); return false;"));
?>

but still nothing!!!

Would you please help me its really urgent !





WebbedIT wrote:
> 
> I wrote a blog post about using ModalBox which is handy if you're
> using Prototype:
> http://webbedit.co.uk/blog_posts/view/tutorial-cakephp-modalbox-crud
> 
> HTH
> 
> Paul.
> 
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Dealing-with-forms%21%21%21%21%21-tp28541795p28558773.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


Re: Offering 10% (negotiable) equity stake to new team member for next-gen product.

2010-05-14 Thread Theaxiom
Oh, I forgot to mention, we launch our invite-only beta on July 4th of
this year. It is coming up very soon.

On May 14, 5:19 am, Jeremy Burns  wrote:
> Very thorough pitch. I know it's hard to quantify, but what is 10% worth? 
> What's the share capital, projected net profits, time to market... Do you 
> have venture capital, if so what are their expectations/exit strategy/time 
> frame. How big is the team? How much is built already?
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 14 May 2010, at 13:10, Theaxiom wrote:
>
>
>
>
>
> > *We are open to both local and remote candidates. Please respond with
> > a portfolio if you have one. Please also note that there is no pay
> > involved, and this is an exciting opportunity but currently it is an
> > equity-only position. Please read our requirements and questionnaire
> > below. *
>
> > --
> > JOB DESCRIPTION
>
> > Kinspir is a stealth-mode startup with an exciting idea and strong
> > team of people. We’re a young, dynamic company that loves to work on
> > fun projects, but we take our work seriously.
>
> > The best candidates will have solid experience developing web
> > applications utilizing Web 2.0 technologies. Our team is committed to
> > working on high quality code in a PHP/LAMP.
>
> > You must have experience with database-driven web technologies to work
> > on high-volume, high-availability, large-scale LAMP / WAMP system. You
> > must be able to write coherent, organized code and be comfortable
> > working on a complicated code-base with high levels of abstraction.
>
> > What you’ll be doing:
>
> > Back end and front end work for our website built entirely in CakePHP
> > 1.3
> > Redesigning new features as laid out by the product manager/architect
> > Designing & implementing core software components for new website
> > features
> > Refactoring our back-end code
> > Front-end work (DHTML, CSS, Javascript using JQuery or other popular
> > javascript frameworks)
> > Identifying bottlenecks & profiling existing PHP code base
> > Helping to advance the state-of-the-art for PHP development &
> > practices.
>
> > QUALIFICATIONS
>
> > Must Have
>
> > At least 5 years software development experience
> > Solid (at least 2 years) of MVC Framework experience (ideally with
> > CakePHP 1.2/1.3).
> > Solid (at least 4 years) of PHP 4+5 experience
> > Solid (3+ years) of MySQL experience
> > Working knowledge of software design patterns (MVC)
> > An intimate familiarity w/ object-oriented PHP & MySQL.
> > Passion for software development and OO Design
> > Guru with presentation layer technologies (HTML, CSS, JavaScript) with
> > cross-browser compatibility is a plus.
> > Familiar with one of the following: jQuery, Mootools, Prototype
> > Javascript frameworks (jQuery experience a huge plus)
> > Strong understanding of web services (REST, SOAP, Advanced XML,
> > SimpleXML) architecture & commonly employed technologies
> > High motivation, excellent teamwork skills, flexibility, and ability
> > to handle multiple tasks.
>
> > Highly desirable:
>
> > Bachelors/Masters Degree in Computer Science or equivalent
> > Working knowledge of caching techniques (memcached & APC)
> > Familiarity a plus in one or more of the following: Linux, Apache
> > Internationalization (i18n) and Localization (l10n) specifically using
> > CakePHP.
>
> > Nice to have:
>
> > Experience developing scalable web applications for high-volume
> > sites.
> > Exp., w/ C / PHP internals
> > Experience with version control systems such as GIT, Subversion or
> > CVS
>
> > 
>
> > We're looking to have someone smart and dedicated to come on board
> > asap. A generous equity stake is involved if you are the right
> > person.
> > Please could you answer the following questions? It would help the
> > team evaluate the breadth/depth of your experience - most of these are
> > yes/no questions. At the same time we'd certainly appreciate some code
> > samples, if you're comfortable sharing them.
>
> > Questions
>
> > Describe the largest/most complicated website you have built using
> > CakePHP.
>
> > How many years experience do you have with CakePHP? What version(s) of
> > CakePHP have you used and for how much time?
>
> > Please give us some examples of websites you have built. Mention what
> > part(s) of each website you were responsible for (back end, front end,
> > both, or a percentage thereof) and how much time doing each part
> > took.
>
> > For the websites you have built using cakephp, did you create unit
> > tests for the models, controllers, plugins, components, helpers,
> > behaviors, etc?
>
> > Please send us some sample code of unit tests you have created.
> > (optional)
>
> > How familiar are you with php simpletest?
>
> > What javascript framework do you use and why? Have you created any
> > javascript plugins for any of the popular frameworks out there?
>
> > Please s

Re: Offering 10% (negotiable) equity stake to new team member for next-gen product.

2010-05-14 Thread Theaxiom
There are over 3,000 man hours currently invested. If you would like
more specific information, please contact me directly.
Thanks

On May 14, 5:19 am, Jeremy Burns  wrote:
> Very thorough pitch. I know it's hard to quantify, but what is 10% worth? 
> What's the share capital, projected net profits, time to market... Do you 
> have venture capital, if so what are their expectations/exit strategy/time 
> frame. How big is the team? How much is built already?
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 14 May 2010, at 13:10, Theaxiom wrote:
>
>
>
>
>
> > *We are open to both local and remote candidates. Please respond with
> > a portfolio if you have one. Please also note that there is no pay
> > involved, and this is an exciting opportunity but currently it is an
> > equity-only position. Please read our requirements and questionnaire
> > below. *
>
> > --
> > JOB DESCRIPTION
>
> > Kinspir is a stealth-mode startup with an exciting idea and strong
> > team of people. We’re a young, dynamic company that loves to work on
> > fun projects, but we take our work seriously.
>
> > The best candidates will have solid experience developing web
> > applications utilizing Web 2.0 technologies. Our team is committed to
> > working on high quality code in a PHP/LAMP.
>
> > You must have experience with database-driven web technologies to work
> > on high-volume, high-availability, large-scale LAMP / WAMP system. You
> > must be able to write coherent, organized code and be comfortable
> > working on a complicated code-base with high levels of abstraction.
>
> > What you’ll be doing:
>
> > Back end and front end work for our website built entirely in CakePHP
> > 1.3
> > Redesigning new features as laid out by the product manager/architect
> > Designing & implementing core software components for new website
> > features
> > Refactoring our back-end code
> > Front-end work (DHTML, CSS, Javascript using JQuery or other popular
> > javascript frameworks)
> > Identifying bottlenecks & profiling existing PHP code base
> > Helping to advance the state-of-the-art for PHP development &
> > practices.
>
> > QUALIFICATIONS
>
> > Must Have
>
> > At least 5 years software development experience
> > Solid (at least 2 years) of MVC Framework experience (ideally with
> > CakePHP 1.2/1.3).
> > Solid (at least 4 years) of PHP 4+5 experience
> > Solid (3+ years) of MySQL experience
> > Working knowledge of software design patterns (MVC)
> > An intimate familiarity w/ object-oriented PHP & MySQL.
> > Passion for software development and OO Design
> > Guru with presentation layer technologies (HTML, CSS, JavaScript) with
> > cross-browser compatibility is a plus.
> > Familiar with one of the following: jQuery, Mootools, Prototype
> > Javascript frameworks (jQuery experience a huge plus)
> > Strong understanding of web services (REST, SOAP, Advanced XML,
> > SimpleXML) architecture & commonly employed technologies
> > High motivation, excellent teamwork skills, flexibility, and ability
> > to handle multiple tasks.
>
> > Highly desirable:
>
> > Bachelors/Masters Degree in Computer Science or equivalent
> > Working knowledge of caching techniques (memcached & APC)
> > Familiarity a plus in one or more of the following: Linux, Apache
> > Internationalization (i18n) and Localization (l10n) specifically using
> > CakePHP.
>
> > Nice to have:
>
> > Experience developing scalable web applications for high-volume
> > sites.
> > Exp., w/ C / PHP internals
> > Experience with version control systems such as GIT, Subversion or
> > CVS
>
> > 
>
> > We're looking to have someone smart and dedicated to come on board
> > asap. A generous equity stake is involved if you are the right
> > person.
> > Please could you answer the following questions? It would help the
> > team evaluate the breadth/depth of your experience - most of these are
> > yes/no questions. At the same time we'd certainly appreciate some code
> > samples, if you're comfortable sharing them.
>
> > Questions
>
> > Describe the largest/most complicated website you have built using
> > CakePHP.
>
> > How many years experience do you have with CakePHP? What version(s) of
> > CakePHP have you used and for how much time?
>
> > Please give us some examples of websites you have built. Mention what
> > part(s) of each website you were responsible for (back end, front end,
> > both, or a percentage thereof) and how much time doing each part
> > took.
>
> > For the websites you have built using cakephp, did you create unit
> > tests for the models, controllers, plugins, components, helpers,
> > behaviors, etc?
>
> > Please send us some sample code of unit tests you have created.
> > (optional)
>
> > How familiar are you with php simpletest?
>
> > What javascript framework do you use and why? Have you created any
> > javascript plugins for any of the popular frameworks out

Re: Offering 10% (negotiable) equity stake to new team member for next-gen product.

2010-05-14 Thread Jeremy Burns
Very thorough pitch. I know it's hard to quantify, but what is 10% worth? 
What's the share capital, projected net profits, time to market... Do you have 
venture capital, if so what are their expectations/exit strategy/time frame. 
How big is the team? How much is built already?

Jeremy Burns
jeremybu...@me.com


On 14 May 2010, at 13:10, Theaxiom wrote:

> *We are open to both local and remote candidates. Please respond with
> a portfolio if you have one. Please also note that there is no pay
> involved, and this is an exciting opportunity but currently it is an
> equity-only position. Please read our requirements and questionnaire
> below. *
> 
> --
> JOB DESCRIPTION
> 
> Kinspir is a stealth-mode startup with an exciting idea and strong
> team of people. We’re a young, dynamic company that loves to work on
> fun projects, but we take our work seriously.
> 
> The best candidates will have solid experience developing web
> applications utilizing Web 2.0 technologies. Our team is committed to
> working on high quality code in a PHP/LAMP.
> 
> You must have experience with database-driven web technologies to work
> on high-volume, high-availability, large-scale LAMP / WAMP system. You
> must be able to write coherent, organized code and be comfortable
> working on a complicated code-base with high levels of abstraction.
> 
> What you’ll be doing:
> 
> Back end and front end work for our website built entirely in CakePHP
> 1.3
> Redesigning new features as laid out by the product manager/architect
> Designing & implementing core software components for new website
> features
> Refactoring our back-end code
> Front-end work (DHTML, CSS, Javascript using JQuery or other popular
> javascript frameworks)
> Identifying bottlenecks & profiling existing PHP code base
> Helping to advance the state-of-the-art for PHP development &
> practices.
> 
> 
> QUALIFICATIONS
> 
> Must Have
> 
> At least 5 years software development experience
> Solid (at least 2 years) of MVC Framework experience (ideally with
> CakePHP 1.2/1.3).
> Solid (at least 4 years) of PHP 4+5 experience
> Solid (3+ years) of MySQL experience
> Working knowledge of software design patterns (MVC)
> An intimate familiarity w/ object-oriented PHP & MySQL.
> Passion for software development and OO Design
> Guru with presentation layer technologies (HTML, CSS, JavaScript) with
> cross-browser compatibility is a plus.
> Familiar with one of the following: jQuery, Mootools, Prototype
> Javascript frameworks (jQuery experience a huge plus)
> Strong understanding of web services (REST, SOAP, Advanced XML,
> SimpleXML) architecture & commonly employed technologies
> High motivation, excellent teamwork skills, flexibility, and ability
> to handle multiple tasks.
> 
> 
> Highly desirable:
> 
> Bachelors/Masters Degree in Computer Science or equivalent
> Working knowledge of caching techniques (memcached & APC)
> Familiarity a plus in one or more of the following: Linux, Apache
> Internationalization (i18n) and Localization (l10n) specifically using
> CakePHP.
> 
> Nice to have:
> 
> Experience developing scalable web applications for high-volume
> sites.
> Exp., w/ C / PHP internals
> Experience with version control systems such as GIT, Subversion or
> CVS
> 
> 
> 
> 
> We're looking to have someone smart and dedicated to come on board
> asap. A generous equity stake is involved if you are the right
> person.
> Please could you answer the following questions? It would help the
> team evaluate the breadth/depth of your experience - most of these are
> yes/no questions. At the same time we'd certainly appreciate some code
> samples, if you're comfortable sharing them.
> 
> 
> Questions
> 
> Describe the largest/most complicated website you have built using
> CakePHP.
> 
> How many years experience do you have with CakePHP? What version(s) of
> CakePHP have you used and for how much time?
> 
> Please give us some examples of websites you have built. Mention what
> part(s) of each website you were responsible for (back end, front end,
> both, or a percentage thereof) and how much time doing each part
> took.
> 
> For the websites you have built using cakephp, did you create unit
> tests for the models, controllers, plugins, components, helpers,
> behaviors, etc?
> 
> Please send us some sample code of unit tests you have created.
> (optional)
> 
> How familiar are you with php simpletest?
> 
> What javascript framework do you use and why? Have you created any
> javascript plugins for any of the popular frameworks out there?
> 
> Please send us a link to the most complicated javascript code you have
> written and are comfortable sharing, that you are proud of.
> (optional)
> 
> Our projects aim to be very ajax-intensive. How comfortable are you
> with using ajax in cakephp?
> 
> Please send us some sample code and demo link for an ajax call 

Offering 10% (negotiable) equity stake to new team member for next-gen product.

2010-05-14 Thread Theaxiom
*We are open to both local and remote candidates. Please respond with
a portfolio if you have one. Please also note that there is no pay
involved, and this is an exciting opportunity but currently it is an
equity-only position. Please read our requirements and questionnaire
below. *

--
JOB DESCRIPTION

Kinspir is a stealth-mode startup with an exciting idea and strong
team of people. We’re a young, dynamic company that loves to work on
fun projects, but we take our work seriously.

The best candidates will have solid experience developing web
applications utilizing Web 2.0 technologies. Our team is committed to
working on high quality code in a PHP/LAMP.

You must have experience with database-driven web technologies to work
on high-volume, high-availability, large-scale LAMP / WAMP system. You
must be able to write coherent, organized code and be comfortable
working on a complicated code-base with high levels of abstraction.

What you’ll be doing:

Back end and front end work for our website built entirely in CakePHP
1.3
Redesigning new features as laid out by the product manager/architect
Designing & implementing core software components for new website
features
Refactoring our back-end code
Front-end work (DHTML, CSS, Javascript using JQuery or other popular
javascript frameworks)
Identifying bottlenecks & profiling existing PHP code base
Helping to advance the state-of-the-art for PHP development &
practices.


QUALIFICATIONS

Must Have

At least 5 years software development experience
Solid (at least 2 years) of MVC Framework experience (ideally with
CakePHP 1.2/1.3).
Solid (at least 4 years) of PHP 4+5 experience
Solid (3+ years) of MySQL experience
Working knowledge of software design patterns (MVC)
An intimate familiarity w/ object-oriented PHP & MySQL.
Passion for software development and OO Design
Guru with presentation layer technologies (HTML, CSS, JavaScript) with
cross-browser compatibility is a plus.
Familiar with one of the following: jQuery, Mootools, Prototype
Javascript frameworks (jQuery experience a huge plus)
Strong understanding of web services (REST, SOAP, Advanced XML,
SimpleXML) architecture & commonly employed technologies
High motivation, excellent teamwork skills, flexibility, and ability
to handle multiple tasks.


Highly desirable:

Bachelors/Masters Degree in Computer Science or equivalent
Working knowledge of caching techniques (memcached & APC)
Familiarity a plus in one or more of the following: Linux, Apache
Internationalization (i18n) and Localization (l10n) specifically using
CakePHP.

Nice to have:

Experience developing scalable web applications for high-volume
sites.
Exp., w/ C / PHP internals
Experience with version control systems such as GIT, Subversion or
CVS




We're looking to have someone smart and dedicated to come on board
asap. A generous equity stake is involved if you are the right
person.
Please could you answer the following questions? It would help the
team evaluate the breadth/depth of your experience - most of these are
yes/no questions. At the same time we'd certainly appreciate some code
samples, if you're comfortable sharing them.


Questions

Describe the largest/most complicated website you have built using
CakePHP.

How many years experience do you have with CakePHP? What version(s) of
CakePHP have you used and for how much time?

Please give us some examples of websites you have built. Mention what
part(s) of each website you were responsible for (back end, front end,
both, or a percentage thereof) and how much time doing each part
took.

For the websites you have built using cakephp, did you create unit
tests for the models, controllers, plugins, components, helpers,
behaviors, etc?

Please send us some sample code of unit tests you have created.
(optional)

How familiar are you with php simpletest?

What javascript framework do you use and why? Have you created any
javascript plugins for any of the popular frameworks out there?

Please send us a link to the most complicated javascript code you have
written and are comfortable sharing, that you are proud of.
(optional)

Our projects aim to be very ajax-intensive. How comfortable are you
with using ajax in cakephp?

Please send us some sample code and demo link for an ajax call done in
cakephp.

How comfortable are you with advanced MySQL queries (inner joins,
outer joins, etc) and MySQL database optimization?

How comfortable are you with database design and normalization?

Have you used Database Triggers?

Have you used Prepared statements in MySQL?

Have you used sub-queries in MySQL?

Have you used smarty or any templating system?

What is your experience with WebServices (REST and SOAP)?

Are you comfortable using the simpleXML APIs in PHP 5?

Do you use any css frameworks in your development?

Have you used xinc/phing or other continuous integration tools in
p

Calling controller from view Vs using define

2010-05-14 Thread Mandy Singh
Hi Everyone,

Quick question:

I need to get something in the view (all views) for which I have a
function defined in the app_controller.

So, what I want to know is what is more efficient?

1. Calling $this->controller->myFun() from the view (of course it
beats the MVC model)

2. Using define() and setting it as a constant through
app_controller ?

I read that define() is an expensive call. I am not killing my self
over over-optimization but thought it would be nice to know if
define() is an expensive call.

Thanks,
Mandy

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


Calling controller from view Vs using define

2010-05-14 Thread Mandy Singh
Hi Everyone,

Quick question:

I need to get something in the view (all views) for which I have a
function defined in the app_controller.

So, what I want to know is what is more efficient?

1. Calling $this->controller->myFun() from the view (of course it
beats the MVC model)

2. Using define() and setting it as a constant through
app_controller ?

I read that define() is an expensive call. I am not killing my self
over over-optimization but thought it would be nice to know if
define() is an expensive call.

Thanks,
Mandy

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


Re: HasOne relation between model with DB like datasource a model with notDB like datasource

2010-05-14 Thread Jeremy Burns
I would do two finds and merge the array afterwards. Assuming ModelA hasOne 
ModelB, do a find on ModelA, pick up the value of the matching id in ModelB, 
then do a find first on ModelB where id = $id.

Jeremy Burns
jeremybu...@me.com


On 14 May 2010, at 12:06, marco.rizze...@gmail.com wrote:

> Hi
> I have to define a hasOne relation between model (model A) with DB
> like datasource a model (model B) with  datasource that isn't a DB.
> If I have this controller operation:
> 
>   pr($this->ModelA->find('all'));
>   die();
> 
> I have noted that CakePHP products a single sql query to find data.
> How can I manage this situation?
> What is the structure to manage this situation?
> Many Thanks
> 
> 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

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


HasOne relation between model with DB like datasource a model with notDB like datasource

2010-05-14 Thread marco.rizze...@gmail.com
Hi
I have to define a hasOne relation between model (model A) with DB
like datasource a model (model B) with  datasource that isn't a DB.
If I have this controller operation:

pr($this->ModelA->find('all'));
die();

I have noted that CakePHP products a single sql query to find data.
How can I manage this situation?
What is the structure to manage this situation?
Many Thanks

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


how to get access to files like swf/pdf in plugins folder?

2010-05-14 Thread Quess
Hi guys,

I have problem with swf files which I'm trying to add to my plugin.
Currently I'm working on jquery file commander plugin for cakephp and
want to add upload feature via swfupload. Problem is that I need to
put somwhere in PLUGIN DIRECTORY swf files but it seems like
impossible to get access to them. I also don't want to put additional
plugin files in webroot - all files should be in plugin directory.
Maybe I'm miss some important info in documentation on how to do that?

Thank you for any help or just hints how to solve this problem.

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


Re: Not able to update record

2010-05-14 Thread Ambika Kulkarni
ya i removed that and it worked

Thanks a lot

On Fri, May 14, 2010 at 3:12 PM, Jeremy Burns  wrote:

> This is caused by your order statement in your hasMany SubCategory...
>
>  'MainCategory.mainCategory ASC',
>>
>
> Try removing it.
>
>
> Jeremy Burns
> jeremybu...@me.com 
>
>
> On 14 May 2010, at 10:38, Ambika Kulkarni wrote:
>
>
> I changed the file name from maincategory.php to main_category.php
>
> and i put this line of code
>  $this->MainCategory->main_category_id = $_POST['id'];
>  $this->MainCategory->save($this->data);
>
> I am getting this error nw
>
> *Warning* (512): *SQL Error:* 1054: Unknown column 
> 'MainCategory.mainCategory' in 'order clause' 
> [*CORE/cake/libs/model/datasources/dbo_source.php*, line *525*]
>
>
>
> On Fri, May 14, 2010 at 1:37 PM, Jeremy Burns  wrote:
>
>> I see several potential problems here, mostly caused by not sticking to
>> conventions.
>>
>> Your model file ought to be called main_category.php
>>
>> If you want to stick to conventions, Id' rename your table's primary key
>> to 'id'. But assuming you won't/can't/don't do this...
>>
>> Why are you using $_POST?
>>
>> It seems as if your form has a field called 'id' that maps to your
>> model/table field main_category_id...baffling.
>>
>> Change this line: $this->MainCategory->mainCategoryId = $_POST['id'];
>> ...to this: $this->MainCategory->main_category_id = $_POST['id'];
>>
>> Jeremy Burns
>> jeremybu...@me.com
>>
>>
>> On 14 May 2010, at 08:43, Ambika Kulkarni wrote:
>>
>> > Hi folks,
>> >
>> > I have a tbl called main_categories
>> > tbl schema is
>> > main_category_id , main_category,type,active,deleted
>> >
>> > model data maincategory.php
>> > class MainCategory extends AppModel {
>> >var $name = 'MainCategory';
>> >var $primaryKey = 'main_category_id';
>> >var $hasMany = array(
>> >   'SubCategory' => array(
>> >'className' => 'SubCategory',
>> >'foreignKey' =>
>> > 'main_category_id',
>> >'dependent' => false,
>> >'conditions' => '',
>> >'fields' => '',
>> >'order' =>
>> > 'MainCategory.mainCategory ASC',
>> >'limit' => '',
>> >'offset' => '',
>> >'exclusive' => '',
>> >'finderQuery' => '',
>> >'counterQuery' => ''),);
>> >
>> > }
>> >
>> > in the main_categories_controller.php
>> > if ( $_POST['a'] == "Update") {
>> >
>> >//$this->MainCategory->recursive = 1;
>> >
>> >$this->MainCategory->mainCategoryId = $_POST['id'];
>> >
>> >$this->MainCategory->save($this->data);
>> >
>> >}
>> > Its not updating the record
>> > $this->MainCategory->id = $_POST['id'];
>> > $this->MainCategory->main_category_id = $_POST['id'];
>> >
>> > not working
>> > Please help me
>> >
>> > 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.comFor
>> >  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>> 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.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>
> 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
>
>
>  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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions 

Re: Not able to update record

2010-05-14 Thread Jeremy Burns
This is caused by your order statement in your hasMany SubCategory...

>  'MainCategory.mainCategory ASC',

Try removing it.


Jeremy Burns
jeremybu...@me.com


On 14 May 2010, at 10:38, Ambika Kulkarni wrote:

> 
> I changed the file name from maincategory.php to main_category.php
> 
> and i put this line of code
>  $this->MainCategory->main_category_id = $_POST['id'];
>  $this->MainCategory->save($this->data);
> 
> I am getting this error nw
> 
> Warning (512): SQL Error: 1054: Unknown column 'MainCategory.mainCategory' in 
> 'order clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 525]
> 
> 
> 
> On Fri, May 14, 2010 at 1:37 PM, Jeremy Burns  wrote:
> I see several potential problems here, mostly caused by not sticking to 
> conventions.
> 
> Your model file ought to be called main_category.php
> 
> If you want to stick to conventions, Id' rename your table's primary key to 
> 'id'. But assuming you won't/can't/don't do this...
> 
> Why are you using $_POST?
> 
> It seems as if your form has a field called 'id' that maps to your 
> model/table field main_category_id...baffling.
> 
> Change this line: $this->MainCategory->mainCategoryId = $_POST['id'];
> ...to this: $this->MainCategory->main_category_id = $_POST['id'];
> 
> Jeremy Burns
> jeremybu...@me.com
> 
> 
> On 14 May 2010, at 08:43, Ambika Kulkarni wrote:
> 
> > Hi folks,
> >
> > I have a tbl called main_categories
> > tbl schema is
> > main_category_id , main_category,type,active,deleted
> >
> > model data maincategory.php
> > class MainCategory extends AppModel {
> >var $name = 'MainCategory';
> >var $primaryKey = 'main_category_id';
> >var $hasMany = array(
> >   'SubCategory' => array(
> >'className' => 'SubCategory',
> >'foreignKey' =>
> > 'main_category_id',
> >'dependent' => false,
> >'conditions' => '',
> >'fields' => '',
> >'order' =>
> > 'MainCategory.mainCategory ASC',
> >'limit' => '',
> >'offset' => '',
> >'exclusive' => '',
> >'finderQuery' => '',
> >'counterQuery' => ''),);
> >
> > }
> >
> > in the main_categories_controller.php
> > if ( $_POST['a'] == "Update") {
> >
> >//$this->MainCategory->recursive = 1;
> >
> >$this->MainCategory->mainCategoryId = $_POST['id'];
> >
> >$this->MainCategory->save($this->data);
> >
> >}
> > Its not updating the record
> > $this->MainCategory->id = $_POST['id'];
> > $this->MainCategory->main_category_id = $_POST['id'];
> >
> > not working
> > Please help me
> >
> > 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
> 
> 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
> 
> 
> 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

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


Re: Not able to update record

2010-05-14 Thread Ambika Kulkarni
I changed the file name from maincategory.php to main_category.php

and i put this line of code
 $this->MainCategory->main_category_id = $_POST['id'];
 $this->MainCategory->save($this->data);

I am getting this error nw

*Warning* (512) : *SQL Error:* 1054: Unknown
column 'MainCategory.mainCategory' in 'order clause'
[*CORE/cake/libs/model/datasources/dbo_source.php*, line *525*]


On Fri, May 14, 2010 at 1:37 PM, Jeremy Burns  wrote:

> I see several potential problems here, mostly caused by not sticking to
> conventions.
>
> Your model file ought to be called main_category.php
>
> If you want to stick to conventions, Id' rename your table's primary key to
> 'id'. But assuming you won't/can't/don't do this...
>
> Why are you using $_POST?
>
> It seems as if your form has a field called 'id' that maps to your
> model/table field main_category_id...baffling.
>
> Change this line: $this->MainCategory->mainCategoryId = $_POST['id'];
> ...to this: $this->MainCategory->main_category_id = $_POST['id'];
>
> Jeremy Burns
> jeremybu...@me.com
>
>
> On 14 May 2010, at 08:43, Ambika Kulkarni wrote:
>
> > Hi folks,
> >
> > I have a tbl called main_categories
> > tbl schema is
> > main_category_id , main_category,type,active,deleted
> >
> > model data maincategory.php
> > class MainCategory extends AppModel {
> >var $name = 'MainCategory';
> >var $primaryKey = 'main_category_id';
> >var $hasMany = array(
> >   'SubCategory' => array(
> >'className' => 'SubCategory',
> >'foreignKey' =>
> > 'main_category_id',
> >'dependent' => false,
> >'conditions' => '',
> >'fields' => '',
> >'order' =>
> > 'MainCategory.mainCategory ASC',
> >'limit' => '',
> >'offset' => '',
> >'exclusive' => '',
> >'finderQuery' => '',
> >'counterQuery' => ''),);
> >
> > }
> >
> > in the main_categories_controller.php
> > if ( $_POST['a'] == "Update") {
> >
> >//$this->MainCategory->recursive = 1;
> >
> >$this->MainCategory->mainCategoryId = $_POST['id'];
> >
> >$this->MainCategory->save($this->data);
> >
> >}
> > Its not updating the record
> > $this->MainCategory->id = $_POST['id'];
> > $this->MainCategory->main_category_id = $_POST['id'];
> >
> > not working
> > Please help me
> >
> > 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.comFor
> >  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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


Re: How to handle multiple user types

2010-05-14 Thread Zaky Katalan-Ezra
What is the other tables?

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


Re: Not able to update record

2010-05-14 Thread Jeremy Burns
I see several potential problems here, mostly caused by not sticking to 
conventions.

Your model file ought to be called main_category.php

If you want to stick to conventions, Id' rename your table's primary key to 
'id'. But assuming you won't/can't/don't do this...

Why are you using $_POST?

It seems as if your form has a field called 'id' that maps to your model/table 
field main_category_id...baffling.

Change this line: $this->MainCategory->mainCategoryId = $_POST['id'];
...to this: $this->MainCategory->main_category_id = $_POST['id'];

Jeremy Burns
jeremybu...@me.com


On 14 May 2010, at 08:43, Ambika Kulkarni wrote:

> Hi folks,
> 
> I have a tbl called main_categories
> tbl schema is
> main_category_id , main_category,type,active,deleted
> 
> model data maincategory.php
> class MainCategory extends AppModel {
>var $name = 'MainCategory';
>var $primaryKey = 'main_category_id';
>var $hasMany = array(
>   'SubCategory' => array(
>'className' => 'SubCategory',
>'foreignKey' =>
> 'main_category_id',
>'dependent' => false,
>'conditions' => '',
>'fields' => '',
>'order' =>
> 'MainCategory.mainCategory ASC',
>'limit' => '',
>'offset' => '',
>'exclusive' => '',
>'finderQuery' => '',
>'counterQuery' => ''),);
> 
> }
> 
> in the main_categories_controller.php
> if ( $_POST['a'] == "Update") {
> 
>//$this->MainCategory->recursive = 1;
> 
>$this->MainCategory->mainCategoryId = $_POST['id'];
> 
>$this->MainCategory->save($this->data);
> 
>}
> Its not updating the record
> $this->MainCategory->id = $_POST['id'];
> $this->MainCategory->main_category_id = $_POST['id'];
> 
> not working
> Please help me
> 
> 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

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


Not able to update record

2010-05-14 Thread Ambika Kulkarni
Hi folks,

I have a tbl called main_categories
tbl schema is
main_category_id , main_category,type,active,deleted

model data maincategory.php
class MainCategory extends AppModel {
var $name = 'MainCategory';
var $primaryKey = 'main_category_id';
var $hasMany = array(
   'SubCategory' => array(
'className' => 'SubCategory',
'foreignKey' =>
'main_category_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' =>
'MainCategory.mainCategory ASC',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''),);

}

in the main_categories_controller.php
if ( $_POST['a'] == "Update") {

//$this->MainCategory->recursive = 1;

$this->MainCategory->mainCategoryId = $_POST['id'];

$this->MainCategory->save($this->data);

}
Its not updating the record
 $this->MainCategory->id = $_POST['id'];
 $this->MainCategory->main_category_id = $_POST['id'];

not working
Please help me

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


Re: 2 models in one view

2010-05-14 Thread
How many preferences do each user have? If its only one then just
change your association to hasOne rather than hasMany and you're fixed
- $user['UserPreference']['image'] works for you.

J

On May 14, 5:12 am, Marek Sebera  wrote:
> Isnť it $user['UserPreference'][0]['image'] ?
>
> Like here:
>
> foreach($user['UserPreference'] as $user){
> $img = $user['image'];
>
> }
>
> Mark
>
> 2010/5/14 bradmaxs 
>
>
>
>
>
> > I know this is probably simple but I have spent a lot of time trying
> > to figure this out and was hoping someone could assist.
>
> > I have a user model and a user_preference model.  user_preference
> > belongs to user.
>
> > I am in view.ctp of the user model and in the dump I have the
> > following array.
>
> > Array
> > (
> >    [User] => Array
> >        (
> >            [id] => 4
> >            [username] => bradmaxs
> >            [password] =>
> >            [first_name] => Bradley
> >            [last_name] => Mackenzie
> >            [street_address] =>
> >            [city] =>
> >            [state] =>
> >            [zip] =>
> >            [country] => USA
> >            [telephone] =>
> >            [email_address] =>
> >            [group_id] => 1
> >            [created] => 2010-05-03 17:33:54
> >            [updated] => 2010-05-09 19:53:35
> >        )
>
> >    [UserPreference] => Array
> >        (
> >            [0] => Array
> >                (
> >                    [id] => 1
> >                    [user_id] => 4
> >                    [image] => bradmaxs.jpg
> >                    [sex] => Male
> >                    [birthdate] =>
> >                    [hometown] => Pittsburgh
> >                    [introduction] =>
> >                    [created] => 2010-05-10 19:32:19
> >                    [modified] => 2010-05-13 17:33:35
> >                )
>
> >        )
>
> > )
>
> > To display info for the user data it baked: $user['User']['username'];
> > and this works great displaying the user model data.
>
> > Then I want to display the user_preference data as well.
>
> > It works great this way:
>
> > 
> >  > border="0" />
> > 
> > 
> > 
> > Html->link(sprintf(__('Edit %s', true), __('User
> > Preference', true)), array('controller' => 'user_preferences',
> > 'action' => 'edit', $userPreference['id'])); ?>
> > 
>
> > But I want to take it out of the foreach loop and include it mixed
> > within the user model data.  I have a lot of other models with
> > relational data that I will need to do the same and I know there must
> > be a way to do this without foreach everytime.
>
> > I tried $user['UserPreference']['image'] and it is saying - :
> > Undefined index: image.
>
> > Any ideas?
>
> > Thanks in advance,
>
> > Brad
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> S pozdravem
> Marek Sebera
> marek.seb...@gmail.com
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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