Setting a Custom error_reporting Level?

2008-02-15 Thread bbf

With DEBUG set to 1, I get a bunch of notices/warning.

I want to set the error_reporting level to "E_ALL ^ E_NOTICE".

I can't seem to figure this out. I tried changing the error_reporting
lines in configure.php & cake.php, but there's no change.

What's the solution to this?  A google search turned up lots of
similar question, but no answers.  Thanks!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CakePHP not writing to Server error logs

2008-02-15 Thread [EMAIL PROTECTED]

I am not getting any PHP errors on the Server Logs if I put DEBUG =
0.
Can anybody tell me how to get the php errors logged to Server Log
even with DEBUG = 0?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Has and belongs to many association question

2008-02-15 Thread Snadly

Brilliant! This actually worked out much better for me.


Thanks

Brad
On Feb 15, 4:01 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Don't use HABTM, make a full model for the table, then change the
> associations to hasMany/belongsTo.
>
> HTH,
> - Dardo Sordi.
>
> On Fri, Feb 15, 2008 at 12:26 AM, Snadly <[EMAIL PROTECTED]> wrote:
>
> >  For this question, lets assume I have 3 models: A, B, and C.
>
> >  I have a HABTM relationship setup between two models, A and B.
>
> >  The many to many table looks like this:
> >  id,
> >  a.id,
> >  b.id,
> >  c.id <--- This can be NULL or it can be a record out of model C.
>
> >  What I want to do is to have the Model C record loaded if the value is
> >  not NULL. I have tried changing the level of recursion, but the
> >  problem is that the HABTM relationship doesn't know that c.id is a
> >  model that can be loaded and I don't know how to tell it such.
>
> >  Any advice?
>
> >  Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



router param mystery

2008-02-15 Thread [EMAIL PROTECTED]

Cake 1.2.0.6311-beta

The 'day' param in the following route is always passed as the same
value as :month, regardless of the :day value in the URL.

Router::connect('/events/:year/:month/:day',
array('controller' => 'events', 'action' => 'view', 'day' => null),
array(
'year' => '[12][0-9]{3}',
'month' => '(0[1-9]|1[012])',
'day' => '(0[1-9]|[12][0-9]|3[01])'
)
);

The first line in ViewsController::view() is:

debug($this->params);

produces:

Array
(
[pass] => Array
(
[0] => 13
[1] => 13
)

[named] => Array
(
)

[year] => 2008
[month] => 02
[day] => 02
[plugin] =>
[controller] => events
[action] => view
[form] => Array
(
)

[url] => Array
(
[url] => events/2008/02/13/
)

[bare] => 0
[webservices] =>
)

If I remove 'day' => null I see this error:

The action 2008 is not defined in controller EventsController

Can anyone spot the problem?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Unidentified property error

2008-02-15 Thread Samuel DeVore

  'WORK' => array('className' => 'Work',

in Person model should be
  'Work' => array('className' => 'Work',

Case is important
also
 var $belongsTo = array(
  'person' => array('className' => 'person',
   'foreignKey' => 'person_id',
   'conditions' => '',
   'fields' => '',
   'order' => ''
  )
 );

should be

 var $belongsTo = array(
  'Person' => array('className' => 'Person',
   'foreignKey' => 'person_id',
   'conditions' => '',
   'fields' => '',
   'order' => ''
  )
 );

Again note capitalization



On Feb 15, 2008 9:12 PM, sixs <[EMAIL PROTECTED]> wrote:
>
> OK,
> This is the models
> ==
>  class Person extends AppModel {
>
>  var $name = 'Person';
>  var $useTable = 'people';
>  var $validate = array(
>   'lastname' => array('alphaNumeric'),
>   'firstname' => array('alphaNumeric'),
>   'street' => array('alphaNumeric'),
>   'city' => array('alphaNumeric'),
>   'state' => array('alphaNumeric'),
>   'zip' => array('alphaNumeric'),
>   'email' => array('email'),
>   'phone' => array('alphaNumeric'),
>   'fax' => array('alphaNumeric')
>  );
>
>  //The Associations below have been created with all possible keys, those
> that are not needed can be removed
>  var $hasMany = array(
>'Event' => array('className' => 'Event',
> 'foreignKey' => 'person_id',
> 'dependent' => false,
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'exclusive' => '',
> 'finderQuery' => '',
> 'counterQuery' => ''
>),
>'WORK' => array('className' => 'Work',
> 'foreignKey' => 'person_id',
> 'dependent' => false,
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'exclusive' => '',
> 'finderQuery' => '',
> 'counterQuery' => ''
>)
>  );
>
> }
> ?>
> ==
>  class Work extends AppModel {
>
>  var $name = 'Work';
>  var $useTable = 'works';
>
>  //The Associations below have been created with all possible keys, those
> that are not needed can be removed
>  var $belongsTo = array(
>'person' => array('className' => 'person',
> 'foreignKey' => 'person_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => ''
>)
>  );
>
> }
> ?>
> ==
>
> - Original Message -
> From: "Samuel DeVore" <[EMAIL PROTECTED]>
> To: 
> Sent: Friday, February 15, 2008 4:04 PM
> Subject: Re: Unidentified property error
>
>
> >
> > On Feb 15, 2008 3:52 PM, sixs <[EMAIL PROTECTED]> wrote:
> >>
> >> Hi,
> >> I have a person table and each person could have many work records in the
> >> works table.
> >> I use bake and I tell cake that a person has many work records, and in
> >> the
> >> works I tell cake that many works records could belong to a person
> >> record.
> >> It generates the code with t table of personand I can select a person to
> >> view and cake displays alll work records that belong to that person.When
> >> I
> >> click on the new work button i get this error instead of showing me the
> >> empty form with the table of person_id to select
> >>  a person from that relates to the person- work link.
> >>  my guess is that there is a problem with your model associations
> >
> > can you post your model files for work and people models
> >
> > you can use http://bin.cakephp.org to keep from cluttering up the list
> > if you want (click save if you want to save the paste for more then a
> > day
> >
> > --
> > --
> > (the old fart) the advice is free, the lack of crankiness will cost you
> >
> > - its a fine line between a real question and an idiot
> >
> > http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
> > http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
> > http://blog.samdevore.com/cakephp-pages/i-cant-bake/
> >
> > >
> >
>
>
>
> >
>



-- 
-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Unidentified property error

2008-02-15 Thread sixs

OK,
This is the models
==
 array('alphaNumeric'),
  'firstname' => array('alphaNumeric'),
  'street' => array('alphaNumeric'),
  'city' => array('alphaNumeric'),
  'state' => array('alphaNumeric'),
  'zip' => array('alphaNumeric'),
  'email' => array('email'),
  'phone' => array('alphaNumeric'),
  'fax' => array('alphaNumeric')
 );

 //The Associations below have been created with all possible keys, those 
that are not needed can be removed
 var $hasMany = array(
   'Event' => array('className' => 'Event',
'foreignKey' => 'person_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
   ),
   'WORK' => array('className' => 'Work',
'foreignKey' => 'person_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
   )
 );

}
?>
==
 array('className' => 'person',
'foreignKey' => 'person_id',
'conditions' => '',
'fields' => '',
'order' => ''
   )
 );

}
?>
==
- Original Message - 
From: "Samuel DeVore" <[EMAIL PROTECTED]>
To: 
Sent: Friday, February 15, 2008 4:04 PM
Subject: Re: Unidentified property error


>
> On Feb 15, 2008 3:52 PM, sixs <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>> I have a person table and each person could have many work records in the
>> works table.
>> I use bake and I tell cake that a person has many work records, and in 
>> the
>> works I tell cake that many works records could belong to a person 
>> record.
>> It generates the code with t table of personand I can select a person to
>> view and cake displays alll work records that belong to that person.When 
>> I
>> click on the new work button i get this error instead of showing me the
>> empty form with the table of person_id to select
>>  a person from that relates to the person- work link.
>>  my guess is that there is a problem with your model associations
>
> can you post your model files for work and people models
>
> you can use http://bin.cakephp.org to keep from cluttering up the list
> if you want (click save if you want to save the paste for more then a
> day
>
> -- 
> -- 
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot
>
> http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
> http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
> http://blog.samdevore.com/cakephp-pages/i-cant-bake/
>
> >
> 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for working with similar model types (noob question!)

2008-02-15 Thread the_woodsman

I haven't done this extensively, but things I've been considering
recently about the subclassing approach:

- Must obey the fat model paradigm, as the more logic you put in the
model, particularly your base model, the more benefit you get from
subclassing in this way.

- Customise the subclasses by adding new fields, manipulating the
model relationships, overriding methods etc.

- Use callbacks (like beforeFind) in the subclasses, to modify queries
generated from the base class.

- Need to pay some attention to when you do and don't call the parent
methods you're overriding, to determine if you use the base classes
functionality at all in a given scenario.

Please, post anything interesting you learn about this approach!







On Feb 15, 5:35 pm, sleepy1038 <[EMAIL PROTECTED]> wrote:
> I am in the same situation as glastoveteran (I am a Cake noob as
> well). I am building a content management system which posts various
> types of content (articles, bulletins, press releases, etc.). They all
> have some common characteristics, but also differ greatly. This is a
> typical is-a relationship. It would be tempted to create separate
> models for each item without a common base table, except I have one
> special condition.
>
> ** All content items must be able to have one or more tags associated
> with them. My thought is to create a tags table, and then a common
> base table for all content types. I could then use as associative
> table to hold content id, tag id pairs.
>
> How would I do this in cake without throwing out all of the built-in
> model functionality that cake offers. For example, when I create,
> delete, or edit a new article, how do get the base model and the
> article model to work together? How about when I add tags to my
> article, how do I get the Article model to pull from the associative
> table I've created?
>
> Am I thinking about this in the wrong way, or am I on the right track?
>
> Thank you for any advice anyone has to offer.
>
> On Feb 15, 11:37 am, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > To keep it simple with cake I have separate tables & models, but if I
> > need to share functionality between models, I use a behaviour.
>
> > What you're saying about using a custom base class for your models/
> > behaviours works well also.
>
> > Ultimately it depends on your data. eg. in my scenario I was going to
> > have a generic "media" table, which would hold videos, images,
> > documents (pdfs), etc, but I eventually moved each type into its own
> > tables, which made much more sense and a heck of a lot easier to
> > manage. I created a generic FileBehaviour which handles the handling
> > of files in general. Then as necessary I created an ImageBehaviour
> > extends FileBehaviour, which added code to deal with images, etc.
>
> > Hope that helps.
>
> > Cheers,
> > Adam
>
> > On Feb 16, 12:08 am, glastoveteran <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
>
> > > I'm building a content managed site with several slightly different
> > > types of record, but all of which feature a common set of fields e.g.
> > > title, summary, description, start_date, end_date, notes, etc.  Some
> > > types of record have one or two extra fields, e.g. location, price,
> > > etc.
>
> > > I've always wondered what's the best way of approaching this with
> > > cake, or indeed any framework?  To have a single database table,
> > > model, controller etc with a field and logic indicating the record
> > > type?  Or to implement each record type with a different table, model,
> > > controller etc?
>
> > > I guess the first option of one model involves less repetition, but
> > > how would you handle different record types having a slightly
> > > different validation rules based on the fact that sopme have extra
> > > fields that need to be validated?  Presumably you'd need to use a
> > > model beforeValidate() function instead of the standard validation
> > > array?
>
> > > The second option would seem to follow the MVC convention a little
> > > better and validation would be easier but seems to have more
> > > repetition.
>
> > > Looking at this in an object oriented way with classes you would I
> > > guess define a base class with the common characteristics and then
> > > extend / specialise this for other models.  How does that work with
> > > cake?
>
> > > Thanks all,
>
> > > Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: More ACL and Auth confusion.

2008-02-15 Thread FrenchEscapes

> If you are using the cake1.2 beta distribution, there was a bug in the
> Auth that would make problems, Try with svn branch or nightly build.


I have the latest svn revision, I keep updating incase it is a bug.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Schema Types

2008-02-15 Thread [EMAIL PROTECTED]

What are all the different schema types (for use in the model)?

I only know of string and text.

What type do you use for radio or select?

e.g.- model:

var $_schema = array(
'firstName' => array('type' => 'string', 'length' => 30),
'lastName'  => array('type' => 'string', 'length' => 30),
'email' => array('type' => 'string', 'length' 
=> 30),
'msg'   => array('type' => 'text')
);


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Primary Keys

2008-02-15 Thread villas

It seems like the idea of having more meaningful primary keys doesn't
have any obstacles.  I'll continue with that.
Thanks everyone!

On Feb 15, 9:12 pm, nate <[EMAIL PROTECTED]> wrote:
> You can use any kind ofprimarykey you want, so long as it doesn't
> include more than one column.
>
> On Feb 15, 6:57 am, villas <[EMAIL PROTECTED]> wrote:
>
>
>
> > > You could set up a "shadow" field in the table to store the human
> > > readable form of theprimarykey, maintained on a trigger.
>
> > That's an idea that I hadn't considered.
>
> > However, I'd only consider this route if someone confirms that my user-
> > friendlyprimarykeysare not recommended in Cake for some reason.- Hide 
> > quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: More ACL and Auth confusion.

2008-02-15 Thread francky06l

If you are using the cake1.2 beta distribution, there was a bug in the
Auth that would make problems, Try with svn branch or nightly build.

On Feb 15, 8:27 pm, FrenchEscapes <[EMAIL PROTECTED]> wrote:
> Not sure if this is normal or what!  I have the beginings of ACL and
> Auth working, where I have groups from admin to customers in aros and
> controllers and actions with root as first parent in acos. The only
> permissions I have set is Admin -> root, admin users can access every
> thing, so far so good. Customer users can only access defined actions
> (pages and register) all others are redirected (perfect) except
> customers can also access all actions of the users controller.
>
> I am using:  $this->Auth->authorize = 'actions';
>
> I have checked and double checked the only controllers/actions I
> have:  $this->Auth->allow(); ed, are "pages" controller and "register"
> action in "users" controller.
>
> I can't figure this one out, thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Unidentified property error

2008-02-15 Thread Samuel DeVore

On Feb 15, 2008 3:52 PM, sixs <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I have a person table and each person could have many work records in the
> works table.
> I use bake and I tell cake that a person has many work records, and in the
> works I tell cake that many works records could belong to a person record.
> It generates the code with t table of personand I can select a person to
> view and cake displays alll work records that belong to that person.When I
> click on the new work button i get this error instead of showing me the
> empty form with the table of person_id to select
>  a person from that relates to the person- work link.
>  my guess is that there is a problem with your model associations

can you post your model files for work and people models

you can use http://bin.cakephp.org to keep from cluttering up the list
if you want (click save if you want to save the paste for more then a
day

-- 
-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: 1.2 Beta Auth Component, Controller other than Users

2008-02-15 Thread Chris Hartjes

On Feb 15, 2008 5:46 PM, Rod D. <[EMAIL PROTECTED]> wrote:
> Thanks so much.
>

See, all you GrumpyCanuck haters out there?  I *do* help people. :P

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Unidentified property error

2008-02-15 Thread sixs
Hi,I have a person table and each person could have many work records in the 
works table.I use bake and I tell cake that a person has many work records, and 
in the works I tell cake that many works records could belong to a person 
record.It generates the code with t table of personand I can select a person to 
view and cake displays alll work records that belong to that person.When I 
click on the new work button i get this error instead of showing me the empty 
form with the table of person_id to select a person from that relates to the 
person- work link. Notice (8): Undefined property:  Work::$Person 
[APP\controllers\works_controller.php, line 30]
Code
}

}

$people = $this->Work->Person->find('list');

WorksController::add() - APP\controllers\works_controller.php, line 30
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 268
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 240
[main] - APP\webroot\index.php, line 84
Fatal error: Call to a member function find() on a non-object in 
C:\VertrigoServ\www\usa\controllers\works_controller.php on line 30
==
This is line 30
  $people = $this->Work->Person->find('list');
=
  $this->set(compact('people'));
===
Code generated in works_controller.php
Work->recursive = 0;
  $this->set('works', $this->paginate());
 }

 function view($id = null) {
  if (!$id) {
   $this->Session->setFlash(__('Invalid Work.', true));
   $this->redirect(array('action'=>'index'));
  }
  $this->set('work', $this->Work->read(null, $id));
 }

 function add() {
  if (!empty($this->data)) {
   $this->Work->create();
   if ($this->Work->save($this->data)) {
$this->Session->setFlash(__('The Work has been saved', true));
$this->redirect(array('action'=>'index'));
   } else {
$this->Session->setFlash(__('The Work could not be saved. Please, try 
again.', true));
   }
  }
  $people = $this->Work->Person->find('list');
  $this->set(compact('people'));
 }

 function edit($id = null) {
  if (!$id && empty($this->data)) {
   $this->Session->setFlash(__('Invalid Work', true));
   $this->redirect(array('action'=>'index'));
  }
  if (!empty($this->data)) {
   if ($this->Work->save($this->data)) {
$this->Session->setFlash(__('The Work has been saved', true));
$this->redirect(array('action'=>'index'));
   } else {
$this->Session->setFlash(__('The Work could not be saved. Please, try 
again.', true));
   }
  }
  if (empty($this->data)) {
   $this->data = $this->Work->read(null, $id);
  }
  $people = $this->Work->Person->find('list');
  $this->set(compact('people'));
 }

 function delete($id = null) {
  if (!$id) {
   $this->Session->setFlash(__('Invalid id for Work', true));
   $this->redirect(array('action'=>'index'));
  }
  if ($this->Work->del($id)) {
   $this->Session->setFlash(__('Work deleted', true));
   $this->redirect(array('action'=>'index'));
  }
 }


 function admin_index() {
  $this->Work->recursive = 0;
  $this->set('works', $this->paginate());
 }

 function admin_view($id = null) {
  if (!$id) {
   $this->Session->setFlash(__('Invalid Work.', true));
   $this->redirect(array('action'=>'index'));
  }
  $this->set('work', $this->Work->read(null, $id));
 }

 function admin_add() {
  if (!empty($this->data)) {
   $this->Work->create();
   if ($this->Work->save($this->data)) {
$this->Session->setFlash(__('The Work has been saved', true));
$this->redirect(array('action'=>'index'));
   } else {
$this->Session->setFlash(__('The Work could not be saved. Please, try 
again.', true));
   }
  }
  $people = $this->Work->Person->find('list');
  $this->set(compact('people'));
 }

 function admin_edit($id = null) {
  if (!$id && empty($this->data)) {
   $this->Session->setFlash(__('Invalid Work', true));
   $this->redirect(array('action'=>'index'));
  }
  if (!empty($this->data)) {
   if ($this->Work->save($this->data)) {
$this->Session->setFlash(__('The Work has been saved', true));
$this->redirect(array('action'=>'index'));
   } else {
$this->Session->setFlash(__('The Work could not be saved. Please, try 
again.', true));
   }
  }
  if (empty($this->data)) {
   $this->data = $this->Work->read(null, $id);
  }
  $people = $this->Work->Person->find('list');
  $this->set(compact('people'));
 }

 function admin_delete($id = null) {
  if (!$id) {
   $this->Session->setFlash(__('Invalid id for Work', true));
   $this->redirect(array('action'=>'index'));
  }
  if ($this->Work->del($id)) {
   $this->Session->setFlash(__('Work deleted', true));
   $this->redirect(array('action'=>'index'));
  }
 }

}
?


Should cakephp generated code point to what?
Thanks
JIm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]

Re: 1.2 Beta Auth Component, Controller other than Users

2008-02-15 Thread Rod D.

Chris, that was it.  I looked at the source and sure enough it had
users/login.


The code in the view that created it was:   create('User', array('action' => 'login'));?>


So, I bet I have to add to that array an entry for the controller.
Thanks so much.
Chris Hartjes wrote:
> On Feb 15, 2008 5:29 PM, Rod D. <[EMAIL PROTECTED]> wrote:
> >
>  >
> > Any help would be greatly appreciated.
> > -Rodney
>
> On your login page, what's the actual target for the POST?  An odd
> thought struck me that you might be pointing at  /users/login in your
> form in the login page instead of /echere/login.
>
> Hope that helps.
>
> --
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard: http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ajax helper question.

2008-02-15 Thread [EMAIL PROTECTED]

I have a popup form that the user will use to edit data. Does anyone
know if there is a way to update the $ajax->div sections of the parent
window from this child window?

Thanks,
Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: 1.2 Beta Auth Component, Controller other than Users

2008-02-15 Thread Chris Hartjes

On Feb 15, 2008 5:29 PM, Rod D. <[EMAIL PROTECTED]> wrote:
>
 >
> Any help would be greatly appreciated.
> -Rodney

On your login page, what's the actual target for the POST?  An odd
thought struck me that you might be pointing at  /users/login in your
form in the login page instead of /echere/login.

Hope that helps.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



1.2 Beta Auth Component, Controller other than Users

2008-02-15 Thread Rod D.

Cake: 1.2.0.6311 beta, Mysql: 5.0
I am having more issues with the 1.2 beta Auth component.
Particularly I am trying to get around having a Users controller.
Let's say I want to use a controller named EcHere instead of Users.

When I enter, localhost/echere/login I get the login prompt served up
by my EcHere controller.

But when I enter the user name and password, I get an error because
Cake is trying to go to, localhost/users/login.  So I get a missing
controller error for Users.

I stripped everything down as small as possible so I would have the
smallest post.

Here is my app_controller.php:
Auth->loginAction = array('controller' => 'echere', 
'action'
=> 'login');
//  $this->Auth->loginRedirect = array('controller' => 'echere',
'action' => 'index');
$this->Auth->logoutRedirect = '/';
}
}
?>

And here is my EcHere_Controller.php:
Auth->allow('login');
$this->Auth->allow('register');
$this->Auth->allow('logout');
}

function index() {
}

function login() {
// only allow access to the page if user has not logged in 
before
if ($this->Auth->user()) {
$this->Session->setFlash('You are already logged in. 
You do
not need to access the logon page again.');
$this->redirect('/echere');
exit;
}

//set the view error var to false. Used to display bad user/pass
error message
$this->set('error', false);

//if we have data
if( ! empty($this->data) ) {
//pass the data to the model so we can manually 
validate things
$this->User->data = $this->data;

//validate the data, and try to authenticate the user
if ( $this->User->validates() ) {
// Nothing.
}
}
}

function logout() {
$this->Auth->logout();
$this->Session->setFlash('You have been logged out. ');
$this->redirect('/');
exit;
}

function register() {
if (!empty($this->data)) {
if ($this->data['User']['password'] == 
$this->Auth->password($this-
>data['User']['password_confirm'])) {
$this->User->create();
$this->User->save($this->data);
$this->redirect(array('action' => 'index'));
}
}
}
}
?>

Any help would be greatly appreciated.
-Rodney

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to divide too large controller into small?

2008-02-15 Thread sanemat

Thanks.
I now understand fat controllers divide into classes.
And I also understand the way I said is wrong.

I get one more question. Where do I put my classes?
I know put them as I want, But where is CakePHP's standard?
Are app/vendors/foo.php and app/vendors/bar.php?
And include them 'vendor(foo, bar);' ?
Or else?

On Feb 15 2008, 5:10 am, MX <[EMAIL PROTECTED]> wrote:
> In OOP theory you can have classes with loads of methods, as long as
> it makes sense.
> Controller methods can be collpsed by almost all editors.
>
> Dont divide that controller that way. Dont worry with 500 lines of
> PHP, as long as all methods are part of Users.
>
> On Feb 14, 7:05 pm, sanemat <[EMAIL PROTECTED]> wrote:
>
> > Thank you for your reply.
> > Yes, I try to thin controllers, and most of business logics move to
> > model.
>
> > But my UsersController has register(), activate(), resign(), edit(),
> > etc...
> > It has over 500 lines PHP Code.
> > So I want to divide it into small files which have less than 50-100
> > lines code.
>
> > On 2/14/08, am7:06, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
> > > Why do yopu want to devide the controller methods ? the whole purpose
> > > of a controller is to _group_ them. You should think about "fat model,
> > > thin controllers" - do a search on that , also you might take a look
> > > at editors wich support code folding - vim, eclipse and *many* others.
>
> > > On 2/13/08, sanemat <[EMAIL PROTECTED]> wrote:
>
> > > > Controllers which have many method (like users_controller) are liable
> > > > to large.
>
> > > > example:
> > > > app/controllers/examples_controller.php
> > > >   class ExamplesController extends AppController {
> > > > function index(){}
> > > > function edit(){}
> > > > function add(){}
> > > > etc...
> > > >   }
>
> > > > I want divide this into small file each method.
> > > > But I don't know how to do it with CakePHP standard.
>
> > > > Now I have 2 ideas.
> > > > --start--
> > > > add:
> > > > app/controllers/examples_edit_controller.php
> > > >   class ExamplesEditController extends ExamplesController {
> > > > function edit($id){
> > > >   //ExamplesController's edit() content write this.
> > > > }
> > > >   }
> > > > edit:
> > > > app/config/rontes.php
> > > >   Router::connect('/example/edit/*', array('controller' =>
> > > > 'examples_edit', 'action' => 'edit'));
> > > > --end--
>
> > > > or
>
> > > > --start--
> > > > add:
> > > > app/controllers/examples/edit.php
> > > >   class ExamplesControllerEdit extends ExamplesController {
> > > > function __construct($id){
> > > >   //ExamplesController's edit() content write this.
> > > > }
> > > >   }
> > > > edit:
> > > > app/controllers/examples_controller.php
> > > >   class ExamplesController extends AppController {
> > > > function edit($id){
> > > >   new ExamplesControllerEdit($id);
> > > > }
> > > >   }
> > > > --end--
>
> > > > But I feel these ideas bad.
> > > > Above idea I must write many Router::connect rules.
> > > > It will confuse me.
> > > > below one I must call many 'require_once' or 'App::import' in every
> > > > place.
> > > > It will also confuse me.
>
> > > > Please give me some advice.
> > > > thanks.
>
> > > --
> > > Marcin Domanskihttp://kabturek.info
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Primary Keys

2008-02-15 Thread nate

You can use any kind of primary key you want, so long as it doesn't
include more than one column.

On Feb 15, 6:57 am, villas <[EMAIL PROTECTED]> wrote:
> > You could set up a "shadow" field in the table to store the human
> > readable form of theprimarykey, maintained on a trigger.
>
> That's an idea that I hadn't considered.
>
> However, I'd only consider this route if someone confirms that my user-
> friendly primary keys are not recommended in Cake for some reason.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Send E-mail

2008-02-15 Thread Wayne Fay

First off, make a little test.php plain PHP file that verifies that
you can send email using PHP's built-in email functionality:
http://us2.php.net/mail

Then make a little test in a Cake controller that you can call
directly which does the same thing. Then you can worry about the
emailcomponent etc.

Wayne

On 2/15/08, dandreta <[EMAIL PROTECTED]> wrote:
>
> Hi!
> I am developing my application with Cake 1.2 and I want to have send e-
> mails functionality.
> Inside pages folder, I have the view to send e-mail with the basic
> fields: Destination, Subject and Message(body). I have been reading
> about EmailComponent in Bakery's article
> (http://bakery.cakephp.org/articles/view/brief-overview-of-the-new-
> emailcomponent) but I have not managed to apply it because e-mail does
> not send. Simply I want to be able to send e-mails with text only.
> How I can do it?
> Do you Know any link or tutorial where it explains?
> Have I configure anything to be able to send e-mails?
> Thanks and regards
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Integrate CakePHP with Eclipse 3.3.1

2008-02-15 Thread Technoguru

I have made some progess, but the controller still does not inherit
the core classes. Here is how far I have gotten:
1. I installed Eclipse PDT
2. I noticed that I was on the PHP navigator and not the PHP explorer
initially, so I opened the explorer by going to Windows -> Show View -
> Other -> PHP Explorer (Under PHP tools).
3. I had to convert the project to a PDT project in order to get the
"Include Path" ability. Right click the project, and click "Convert to
PDT project". Now if you right click you will see the "Include
Path"options.
After including the path to the cake core, it stills seems like it is
not working. I look in the Outline, and the core classes are not
present, and auto complete does not work. Can someone please help us
out. Thanks.
__

On Feb 12, 5:46 pm, Technoguru <[EMAIL PROTECTED]> wrote:
> I have been following the tutorial 
> athttp://bakery.cakephp.org/articles/view/setting-up-eclipse-to-work-wi...,
> in order to setup a cakePHP and Eclipse Environment that will give me
> the ability to use cakePHP code completion, as well as run the bake
> script in the Eclipse Workspace.  However it does not seem to work.  I
> am using CakePHP 1.2 and Eclipse 3.3.1 on a Windows XP, that has
> Apache, PHP, and MYSQL already installed.  I get to the point labeled
> "Defining projects" in the tutorial, and can't get cake and my project
> to link up.
>
> Can someone explain how my files need to be setup (where do I place
> the core, and where my projects go in relation to it), how to link the
> cake core files into my project so I have access to its classes, how
> to verify that the link was made, and finally the syntax to setup the
> bake script.  The more detail, the better.  Thank you very much.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



More ACL and Auth confusion.

2008-02-15 Thread FrenchEscapes

Not sure if this is normal or what!  I have the beginings of ACL and
Auth working, where I have groups from admin to customers in aros and
controllers and actions with root as first parent in acos. The only
permissions I have set is Admin -> root, admin users can access every
thing, so far so good. Customer users can only access defined actions
(pages and register) all others are redirected (perfect) except
customers can also access all actions of the users controller.

I am using:  $this->Auth->authorize = 'actions';

I have checked and double checked the only controllers/actions I
have:  $this->Auth->allow(); ed, are "pages" controller and "register"
action in "users" controller.

I can't figure this one out, thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Does the Cake schema tool allow one to define the type of a table (innodb, etc)?

2008-02-15 Thread Aaron Shafovaloff

Does the Cake schema tool allow one to define the type of a table
(innodb, etc)?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controller, Add Method.. setting default values..

2008-02-15 Thread Dardo Sordi Bogado

Nice one!

On Fri, Feb 15, 2008 at 3:49 PM, francky06l <[EMAIL PROTECTED]> wrote:
>
>  If you define some default value in the database definition (not null
>  and a default), you can call $this->data = $this->Expense->create() in
>  controller prior to render the view. The default value defined in the
>  table will be used.
>  hth
>
>
>
>  On Feb 15, 6:14 am, duncan_m <[EMAIL PROTECTED]> wrote:
>  > Thanks.. I had a typo.. its working now :)
>  >
>  > I see that the view would be a better place for the logic. Thanks for
>  > that hint.
>  >
>  > Duncan.
>  >
>  > On Feb 15, 1:29 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
>  >
>  > > This works for me in latest 1.2.
>  >
>  > > However, maybe this logic should be in your view??
>  >
>  > > echo $form->input('anotherfield', array('default' => 'A default
>  > > value'));
>  >
>  > > Cheers,
>  > > Adam
>  >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp pluralisation doesnt work with my scaffolds..

2008-02-15 Thread Dardo Sordi Bogado

Can you post the complete error messages?

On Fri, Feb 15, 2008 at 10:20 AM, blain57 <[EMAIL PROTECTED]> wrote:
>
>  Is it possible to give me an example based on a table named
>  ticket_activities?
>
>  I opened the inflection file.. and was shocked ! :P
>
>  thanx
>
>
>  On Feb 15, 1:48 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>  > Try setting it on config/inflections.php
>  >
>
>
> > On Thu, Feb 14, 2008 at 2:30 PM, blain57 <[EMAIL PROTECTED]> wrote:
>  >
>  > >  Hi all,
>  >
>  > >  simple example:
>  >
>  > >  i make a ticket_activities table
>  > >  i make a ticket_activity.php file model with:
>  >
>  > >  class TicketActivity extends AppModel
>  > >  {
>  > > var $name = 'TicketActivity';
>  > >  }
>  >
>  > >  and a ticket_activities_controller.php with:
>  >
>  > >  class TicketActivitiesController extends AppController
>  > >  {
>  > > var $scaffold;
>  > >  }
>  >
>  > >  and i get the following errors:
>  >
>  > >  Notice: Trying to get property of non-object
>  > >  Warning: Invalid argument supplied for foreach()
>  >
>  > >  Scaffolding works with tables without underscores tho
>  >
>  > >  I am running cake on a windows 2003 server with iis6 and php5 but
>  > >  without rewrite.
>  >
>  > >  Thanx in advance.
>
>  >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Secure installation on a shared webhost

2008-02-15 Thread Baz
You need to be more specific with your question.

CakePHP isn't much different to dropping in phpBB or something, with respect
to security (sort of).

You follow the same basic rules: Cake sure only the appropriate files and
directories are writable (/app/tmp/*), and that's it. Not much difference.
The section on httd.conf simply controls where the browser goes to when you
type in yousite.com/cakeproject/. Ideally, it should go to /app/webroot/.
Even without HTTD access, most shared hosts that allow multiple domains have
some method of mapping (at least the add-ons domains. Hostmonster doesn't
allow you to move the main domain location).

For hosts that don't allow this, CakePHP includes the .htaccess rewrites.
These basically forwards the browser to the webroot folder.

So, there's not much else to consider when thinking about a shared hosts. A
lot of stuff is already locked down, a lot of permissions are already set so
that only apache can access certain things.

The real security issues come into play when you're running your own server
and you have to control all these things manually.

On Fri, Feb 15, 2008 at 2:45 AM, domeng <[EMAIL PROTECTED]> wrote:

>
> Hi! I'm developing a cake app that will be served on shared webhosting
> (hostmonster). I've read the manual for installation but the
> Production and Advanced installation notes discussed instructions for
> somebody with access on httpd config. How can I have a secure
> installation of cake on a shared web hosting account? What are the
> things that I need to consider? Thank you very much and happy baking
> to everyone!
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for working with similar model types (noob question!)

2008-02-15 Thread sleepy1038

I am in the same situation as glastoveteran (I am a Cake noob as
well). I am building a content management system which posts various
types of content (articles, bulletins, press releases, etc.). They all
have some common characteristics, but also differ greatly. This is a
typical is-a relationship. It would be tempted to create separate
models for each item without a common base table, except I have one
special condition.

** All content items must be able to have one or more tags associated
with them. My thought is to create a tags table, and then a common
base table for all content types. I could then use as associative
table to hold content id, tag id pairs.

How would I do this in cake without throwing out all of the built-in
model functionality that cake offers. For example, when I create,
delete, or edit a new article, how do get the base model and the
article model to work together? How about when I add tags to my
article, how do I get the Article model to pull from the associative
table I've created?

Am I thinking about this in the wrong way, or am I on the right track?

Thank you for any advice anyone has to offer.

On Feb 15, 11:37 am, Adam Royle <[EMAIL PROTECTED]> wrote:
> To keep it simple with cake I have separate tables & models, but if I
> need to share functionality between models, I use a behaviour.
>
> What you're saying about using a custom base class for your models/
> behaviours works well also.
>
> Ultimately it depends on your data. eg. in my scenario I was going to
> have a generic "media" table, which would hold videos, images,
> documents (pdfs), etc, but I eventually moved each type into its own
> tables, which made much more sense and a heck of a lot easier to
> manage. I created a generic FileBehaviour which handles the handling
> of files in general. Then as necessary I created an ImageBehaviour
> extends FileBehaviour, which added code to deal with images, etc.
>
> Hope that helps.
>
> Cheers,
> Adam
>
> On Feb 16, 12:08 am, glastoveteran <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I'm building a content managed site with several slightly different
> > types of record, but all of which feature a common set of fields e.g.
> > title, summary, description, start_date, end_date, notes, etc.  Some
> > types of record have one or two extra fields, e.g. location, price,
> > etc.
>
> > I've always wondered what's the best way of approaching this with
> > cake, or indeed any framework?  To have a single database table,
> > model, controller etc with a field and logic indicating the record
> > type?  Or to implement each record type with a different table, model,
> > controller etc?
>
> > I guess the first option of one model involves less repetition, but
> > how would you handle different record types having a slightly
> > different validation rules based on the fact that sopme have extra
> > fields that need to be validated?  Presumably you'd need to use a
> > model beforeValidate() function instead of the standard validation
> > array?
>
> > The second option would seem to follow the MVC convention a little
> > better and validation would be easier but seems to have more
> > repetition.
>
> > Looking at this in an object oriented way with classes you would I
> > guess define a base class with the common characteristics and then
> > extend / specialise this for other models.  How does that work with
> > cake?
>
> > Thanks all,
>
> > Alex

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



SessionComponent vs sessioncomponent, case sensitive?

2008-02-15 Thread kienpham2000

Hi All,

On my local development machine, I use php 5 and on the production, it
uses php 4.2

I was having problem when user authenticated, I redirect them to
another controller but somehow the session drop (only in IE).

I did the check inside the app_controller.php file. I tried to print
out the test
pr($this->Session) and found out:

sessioncomponent Object
(
[_log] =>
[valid] =>
[error] =>
[_userAgent] => f9b8d2d48ef5eefcca002f090fc1b4e9
[path] => /
[lastError] =>
[security] => low
[time] => 1203089149
[sessionTime] => 1203125149
[watchKeys] => Array
(
)

[id] =>
[__active] => 1
[__started] =>
[__bare] => 0



The sessioncomponent  should be SessionComponent. Then I fixed this by
loading the component using the lowercase:
var $components = array('session') instead of
var $components = array('Session')

Does any one know how to get the sessioncomponent to be in the upper
case, SessionComponent?

I use the new cake beta, 1.2

Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp pluralisation doesnt work with my scaffolds..

2008-02-15 Thread blain57

Is it possible to give me an example based on a table named
ticket_activities?

I opened the inflection file.. and was shocked ! :P

thanx

On Feb 15, 1:48 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Try setting it on config/inflections.php
>
> On Thu, Feb 14, 2008 at 2:30 PM, blain57 <[EMAIL PROTECTED]> wrote:
>
> >  Hi all,
>
> >  simple example:
>
> >  i make a ticket_activities table
> >  i make a ticket_activity.php file model with:
>
> >  class TicketActivity extends AppModel
> >  {
> > var $name = 'TicketActivity';
> >  }
>
> >  and a ticket_activities_controller.php with:
>
> >  class TicketActivitiesController extends AppController
> >  {
> > var $scaffold;
> >  }
>
> >  and i get the following errors:
>
> >  Notice: Trying to get property of non-object
> >  Warning: Invalid argument supplied for foreach()
>
> >  Scaffolding works with tables without underscores tho
>
> >  I am running cake on a windows 2003 server with iis6 and php5 but
> >  without rewrite.
>
> >  Thanx in advance.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth 1.2 - login only if user state = activated?

2008-02-15 Thread Joe

Quick snippet form my project:

// block users who are not marked 'active'
$this->Auth->userScope = array(
'User.active' => 1
);

Works as advertised...


On 15 feb, 11:43, Tim W <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> My user table/model has a state_id field. I'd like to configure Auth
> so that it only lets people login is the state is a certain value. Is
> there an easy way to do this?
>
> Two lines in auth.php suggest it should be possible
>
> 38: $conditions = $this->userScope;  // (previously $conditions is a
> null parameter)
> 77: $data = $model->find(array_merge($find, $conditions), null, null,
> -1);
>
> If I could work out how to pass a condition in that would do the job.
> Has anyone done it?
>
> Thanks
>
> Tim

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Developer needed for agency in NW London, UK

2008-02-15 Thread eagerterrier

Story goes like this -

Netro42 have recently embraced CakePHP. We have spawned 4 major
cakephp sites in the last year (including the Daily Express and Daily
Star), and have many more in development. All the work we are
currently doing is exciting and I can feel that this agency is
actually going somewhere.

We are currently looking for a developer. Experience of CakePHP is a
plus. Otherwise, it will be like groundhog day for me having taught 3
developers already.

We are ideally looking for a middleweight developer - someone who has
4 years experience working with some nice brands - but will consider
hiring a junior, too - especially if they can demonstrate an
enthusiasm for the job and a ability to work brilliantly under
pressure.  The next 3 months will be pretty tough but fantastically
rewarding for the right candidate. We will give you commercial
experience, a nice looking CV and as much coffee as you can drink in
return for your logic and typing skills.

Salary is dependent on experience etc, but could be anywhere between
£20k and £30k. Plus home broadband paid for as an expense.

If you are interested, email me or our vacancies hotline  -
[EMAIL PROTECTED]

And if you are going to go straight to the site, please don't judge
us. We know it's pants, but it looked mighty fine in 2001 - we've just
been too busy to make it look nice - sign of a good agency I guess?




Not sure if this is right place for this. Any other cake job posting
boards seem to be US-centric. Apologies if this has gone in the wrong
place. Don't flame me. Please.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Boolean value postgres

2008-02-15 Thread Stefan

Hello,

I am using cake 1.1.15.5144 with PHP5 and postgres 8.2.5.
The problem is that boolean values from the database are stored within
the model as strings ('t' / 'f').
Is there a solution that the model stores 'real' boolean (TRUE/FALSE)
values?
There is a function "boolean" in dbo_postgres.php that does the
mapping, but it seems that the values stored from the database to the
model are not translated.

Regards

Stefan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CookBook and i18n

2008-02-15 Thread r0sk
2008/2/14, r0sk <[EMAIL PROTECTED]>:
>
> Hi people:
>
> I'm now trying to add i18n on a webapp but I dunno how's the right use of
> Translate Behavior. I'd seen that the new CookBook had i18n and I would be
> pleased to see the code. Anyone knows if there is a SVN/Trac or so to see
> how it works.
>
> Thanks
>

Does Translate behavior create a new general entry for each translation? I
try to insert two translations in a loop (changing model->locale) and get
two general entries in the main table and two translation entries in i18n
table:

class Prueba extends AppModel
{
var $name = 'Prueba';
var $actsAs = array('Translate' => array('title', 'content'));
}

function admin_add($lang = null)
{
if (!empty($this->data))
{
$this->Prueba->create();
$languages = array('spa', 'eng', 'por', 'gal', 'ped');
foreach($languages as $v)
{
$data = array('title' => 'A title', 'content' => 'A
Content');
$this->Prueba->create($data);
$this->Prueba->locale=$v;
$this->Prueba->save($data);
$id = $this->Prueba->id;
}
}
}

Any tip?
-- 
http://www.userlinux.net
http://7throot.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Secure installation on a shared webhost

2008-02-15 Thread domeng

Hi! I'm developing a cake app that will be served on shared webhosting
(hostmonster). I've read the manual for installation but the
Production and Advanced installation notes discussed instructions for
somebody with access on httpd config. How can I have a secure
installation of cake on a shared web hosting account? What are the
things that I need to consider? Thank you very much and happy baking
to everyone!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Paypal / Submitting Hidden Values through CakePHP

2008-02-15 Thread shiny

Hi,

In CakePHP, i want to integrate the paypal.
Is there any possible way to do the process by Submitting the Hidden
Values to paypal like php?

Thanks,

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controller, Add Method.. setting default values..

2008-02-15 Thread francky06l

If you define some default value in the database definition (not null
and a default), you can call $this->data = $this->Expense->create() in
controller prior to render the view. The default value defined in the
table will be used.
hth

On Feb 15, 6:14 am, duncan_m <[EMAIL PROTECTED]> wrote:
> Thanks.. I had a typo.. its working now :)
>
> I see that the view would be a better place for the logic. Thanks for
> that hint.
>
> Duncan.
>
> On Feb 15, 1:29 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > This works for me in latest 1.2.
>
> > However, maybe this logic should be in your view??
>
> > echo $form->input('anotherfield', array('default' => 'A default
> > value'));
>
> > Cheers,
> > Adam
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Send E-mail

2008-02-15 Thread dandreta

Hi!
I am developing my application with Cake 1.2 and I want to have send e-
mails functionality.
Inside pages folder, I have the view to send e-mail with the basic
fields: Destination, Subject and Message(body). I have been reading
about EmailComponent in Bakery's article
(http://bakery.cakephp.org/articles/view/brief-overview-of-the-new-
emailcomponent) but I have not managed to apply it because e-mail does
not send. Simply I want to be able to send e-mails with text only.
How I can do it?
Do you Know any link or tutorial where it explains?
Have I configure anything to be able to send e-mails?
Thanks and regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Caching and writing to sessions

2008-02-15 Thread Richard

anyone?

On Feb 14, 4:40 pm, Richard <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have an entire view that I cache other than a phone number that is
> output based on the user's geographic location  ...US visitors would
> see an 1-800 number, UK 0800 etc. Therefore I have cached the view
> using the $cacheAction array within the controller and written a
> helper that looks up the user's IP and outputs the correct phone
> number based on their location. The helper call within the view is
> wrapped with no cache tags getSalesNumber()?
>
> >
>
> My problem is that within the helper class I read and write to
> sessions to prevent overhead with accessing an ip-lookup service,
> however you cannot write to sessions within helpers. I have worked
> around this by using PHP's session support. I would just like to know
> if there is a better way for me to do this other than the before
> mentioned hack? This is a public website so there is no opportunity in
> setting a session within a login script.
>
> Many thanks,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Database Sessions not working at all in 1.2

2008-02-15 Thread Manu0310

Hey guys, I am using cakePHP 1.2 beta release and I cant get any
session handling to work correctly.
Right now I am trying to use database session handling and my core.php
settings are as follows:

Configure::write('Session.save', 'database');
Configure::write('Session.table', 'cake_sessions');
Configure::write('Session.database', 'default');
Configure::write('Session.cookie', 'CAKEPHP');
Configure::write('Session.timeout', '180');
Configure::write('Session.start', true);
Configure::write('Session.checkAgent', true);

I tried setting checkAgent to false, Session.start to false... nothing
helped. The only session entry I am getting in my table is the initial
one when I first load my website.

I really need to solve this fast so any help would be appreciated

Thanks a lot.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validation criteria "alphaNumeric" doesn't accept special chars

2008-02-15 Thread Samuel DeVore

perhaps someone familiar with these non-americacentric languanges
could suggest in a trac ticket a regex query that would include these
other characters

The check now is for
$_this->regex = '/[^\\dA-Z]/i';

so suggest the fix to help them, I'm not familiar enough with the
other languages to be a lot of help



Sam D


On Fri, Feb 15, 2008 at 9:33 AM, grigri <[EMAIL PROTECTED]> wrote:
>
>  > But it's anormal for "accented characters" which often exist in French
>  > or European language and are real letters...
>
>  "real letters"? By that rationale, all other alphabets should validate
>  too: from greek to cyrillic and hiragana. Can you imagine the regexp
>  for that?. I understand your frustration, but "alphanumeric" means
>  just the base 26 latin letters and 10 arabic numerals, nothing else.
>  It doesn't mean "valid text in any language known to man". Just how
>  useful this validation method is remains to be seen...
>
>
>
>  On Feb 15, 4:26 pm, avairet <[EMAIL PROTECTED]> wrote:
>  > OK! Thank's.
>  > I've found myself and I've wrote a regular expression!
>  >
>  > It's normal "alphaNumeric validation criteria" doesn't work for "blank
>  > character" which are not "letter" or "number", I'm stupid!
>  > But it's anormal for "accented characters" which often exist in French
>  > or European language and are real letters...
>  >
>  > BR
>  >
>  > Aurélien
>  >
>  > On 15 fév, 17:12, Adam Royle <[EMAIL PROTECTED]> wrote:
>  >
>  > > This has been reported by others before, but the cake team has said
>  > > this is the expected functionality. If you're really worried about
>  > > validating this data then validate the length of the data, otherwise
>  > > write a custom regex to handle your requirements.
>  >
>  > > Cheers,
>  > > Adam
>  >
>  > > On Feb 16, 1:56 am, avairet <[EMAIL PROTECTED]> wrote:
>  >
>  > > > Hi,
>  >
>  > > > Model : "nature" (id int auto-increment PK / label varchar (50) )
>  >
>  > > > var $validate = array(
>  > > >'label' => array('alphaNumeric')
>  > > > );
>  >
>  > > > Create basic functions in NaturesController (view, add, edit)
>  >
>  > > > I launch : "myapp/natures/add"
>  >
>  > > > Add new Nature with label "Article" work fine. Data is saved
>  > > > correctly.
>  > > > But add label with special characters, like "é" or "-" or blank:
>  > > > validation failed!
>  > > > Error message is: 'The Nature could not be saved. Please, try again.
>  > > > This field cannot be left blank'!?
>  > > > I've tested with the 1.2.x.x Nightly builds and 1.2.0.6311 and
>  > > > 1.2.0.5875 releases and the problem remains.
>  >
>  > > > Have you noticed that?
>  >
>  > > > Avairet
>  >
>



-- 
-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Switching useDbConfig variable

2008-02-15 Thread Seandy
english please...

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for working with similar model types (noob question!)

2008-02-15 Thread Adam Royle

To keep it simple with cake I have separate tables & models, but if I
need to share functionality between models, I use a behaviour.

What you're saying about using a custom base class for your models/
behaviours works well also.

Ultimately it depends on your data. eg. in my scenario I was going to
have a generic "media" table, which would hold videos, images,
documents (pdfs), etc, but I eventually moved each type into its own
tables, which made much more sense and a heck of a lot easier to
manage. I created a generic FileBehaviour which handles the handling
of files in general. Then as necessary I created an ImageBehaviour
extends FileBehaviour, which added code to deal with images, etc.

Hope that helps.

Cheers,
Adam


On Feb 16, 12:08 am, glastoveteran <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm building a content managed site with several slightly different
> types of record, but all of which feature a common set of fields e.g.
> title, summary, description, start_date, end_date, notes, etc.  Some
> types of record have one or two extra fields, e.g. location, price,
> etc.
>
> I've always wondered what's the best way of approaching this with
> cake, or indeed any framework?  To have a single database table,
> model, controller etc with a field and logic indicating the record
> type?  Or to implement each record type with a different table, model,
> controller etc?
>
> I guess the first option of one model involves less repetition, but
> how would you handle different record types having a slightly
> different validation rules based on the fact that sopme have extra
> fields that need to be validated?  Presumably you'd need to use a
> model beforeValidate() function instead of the standard validation
> array?
>
> The second option would seem to follow the MVC convention a little
> better and validation would be easier but seems to have more
> repetition.
>
> Looking at this in an object oriented way with classes you would I
> guess define a base class with the common characteristics and then
> extend / specialise this for other models.  How does that work with
> cake?
>
> Thanks all,
>
> Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validation criteria "alphaNumeric" doesn't accept special chars

2008-02-15 Thread avairet

OK! Thank's.
I've found myself and I've wrote a regular expression!

It's normal "alphaNumeric validation criteria" doesn't work for "blank
character" which are not "letter" or "number", I'm stupid!
But it's anormal for "accented characters" which often exist in French
or European language and are real letters...

BR

Aurélien


On 15 fév, 17:12, Adam Royle <[EMAIL PROTECTED]> wrote:
> This has been reported by others before, but the cake team has said
> this is the expected functionality. If you're really worried about
> validating this data then validate the length of the data, otherwise
> write a custom regex to handle your requirements.
>
> Cheers,
> Adam
>
> On Feb 16, 1:56 am, avairet <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > Model : "nature" (id int auto-increment PK / label varchar (50) )
>
> > var $validate = array(
> >'label' => array('alphaNumeric')
> > );
>
> > Create basic functions in NaturesController (view, add, edit)
>
> > I launch : "myapp/natures/add"
>
> > Add new Nature with label "Article" work fine. Data is saved
> > correctly.
> > But add label with special characters, like "é" or "-" or blank:
> > validation failed!
> > Error message is: 'The Nature could not be saved. Please, try again.
> > This field cannot be left blank'!?
> > I've tested with the 1.2.x.x Nightly builds and 1.2.0.6311 and
> > 1.2.0.5875 releases and the problem remains.
>
> > Have you noticed that?
>
> > Avairet
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to getting started ???

2008-02-15 Thread [EMAIL PROTECTED]

That is correct, however, be aware that setting the debug to 0 causes
the table schemas to be cached. Ideal in a production environment, but
if you are still making changes to your tables you won't see those
changes until the cache is refreshed.  If you set your debug level to
1, you won't see the queries being output on the bottom of the page,
nor will it cache your schema.

On Feb 15, 3:49 am, Miki <[EMAIL PROTECTED]> wrote:
> > My "Hello world" is ok now. But when I try to work with database, html
> > out put always have a table with query string and some infomation 
>
> > How to remove it. I want to have a layout same CodeIgniter or ZF.
> > I know cakePHP have more helpful but I dont want see it in my
> > website 
>
> Hello, im very newbie too, but i think you can change debug value to 0
> (zero, production) in the config/core.php
>
> Miki
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validation criteria "alphaNumeric" doesn't accept special chars

2008-02-15 Thread grigri

> But it's anormal for "accented characters" which often exist in French
> or European language and are real letters...

"real letters"? By that rationale, all other alphabets should validate
too: from greek to cyrillic and hiragana. Can you imagine the regexp
for that?. I understand your frustration, but "alphanumeric" means
just the base 26 latin letters and 10 arabic numerals, nothing else.
It doesn't mean "valid text in any language known to man". Just how
useful this validation method is remains to be seen...

On Feb 15, 4:26 pm, avairet <[EMAIL PROTECTED]> wrote:
> OK! Thank's.
> I've found myself and I've wrote a regular expression!
>
> It's normal "alphaNumeric validation criteria" doesn't work for "blank
> character" which are not "letter" or "number", I'm stupid!
> But it's anormal for "accented characters" which often exist in French
> or European language and are real letters...
>
> BR
>
> Aurélien
>
> On 15 fév, 17:12, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > This has been reported by others before, but the cake team has said
> > this is the expected functionality. If you're really worried about
> > validating this data then validate the length of the data, otherwise
> > write a custom regex to handle your requirements.
>
> > Cheers,
> > Adam
>
> > On Feb 16, 1:56 am, avairet <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > Model : "nature" (id int auto-increment PK / label varchar (50) )
>
> > > var $validate = array(
> > >'label' => array('alphaNumeric')
> > > );
>
> > > Create basic functions in NaturesController (view, add, edit)
>
> > > I launch : "myapp/natures/add"
>
> > > Add new Nature with label "Article" work fine. Data is saved
> > > correctly.
> > > But add label with special characters, like "é" or "-" or blank:
> > > validation failed!
> > > Error message is: 'The Nature could not be saved. Please, try again.
> > > This field cannot be left blank'!?
> > > I've tested with the 1.2.x.x Nightly builds and 1.2.0.6311 and
> > > 1.2.0.5875 releases and the problem remains.
>
> > > Have you noticed that?
>
> > > Avairet
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: PostgreSQL Update Query and the trouble with aliases

2008-02-15 Thread nate

Please do everyone else a favor and search around a little bit next
time.  This bug has already been reported a zillion times, and was
fixed weeks ago.

On Jan 21, 8:58 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I'm having trouble making UPDATE queries in PostgreSQL. I know that
> there is a known issue about Postgres not supporting aliases in UPDATE
> queries. Anyway, my problem is that when I try to create new Aro like
> this:
>
>                 $parent = $this->Acl->Aro->findByAlias('SuperUser');
>                 $parentId = $parent['Aro']['id'];
>
>                 $this->Acl->Aro->create();
>                 $this->Acl->Aro->save(array(
>                         'foreign_key' => null,
>                         'parent_id' => $parentId,
>                         'alias' => 'User:30'));
>
> I get the following error:
>
> Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:
> column "Aro" of relation "aros" does not exist
> LINE 1: UPDATE "aros" AS "Aro"  SET "Aro"."lft" = "Aro"."lft" + 2
> W...
>                                     ^ [CORE\cake\libs\model\datasources
> \dbo\dbo_postgres.php, line 123]
> $sql    =       "UPDATE "aros" AS "Aro"  SET "Aro"."lft" = "Aro"."lft" + 2
> WHERE "Aro"."lft" >=  '2'"
>
> I've already posted a bug to trac.cakephp.org... the reason for this
> message is that I would like to ask everybody for help on creating
> some quick solution or patch for this problem.
>
> P.S. This problem with aliases isn't just a one time thing, it is and
> will be happening until cakephp developers move the method
> renderStatement from dbo_source.php to each dbo file. It should work
> as it is, but it doesn't, they should all follow SQL standards but
> they don't. So, my suggestion is to make renderStatement in every dbo.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validation criteria "alphaNumeric" doesn't accept special chars

2008-02-15 Thread Adam Royle

This has been reported by others before, but the cake team has said
this is the expected functionality. If you're really worried about
validating this data then validate the length of the data, otherwise
write a custom regex to handle your requirements.

Cheers,
Adam

On Feb 16, 1:56 am, avairet <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Model : "nature" (id int auto-increment PK / label varchar (50) )
>
> var $validate = array(
>'label' => array('alphaNumeric')
> );
>
> Create basic functions in NaturesController (view, add, edit)
>
> I launch : "myapp/natures/add"
>
> Add new Nature with label "Article" work fine. Data is saved
> correctly.
> But add label with special characters, like "é" or "-" or blank:
> validation failed!
> Error message is: 'The Nature could not be saved. Please, try again.
> This field cannot be left blank'!?
> I've tested with the 1.2.x.x Nightly builds and 1.2.0.6311 and
> 1.2.0.5875 releases and the problem remains.
>
> Have you noticed that?
>
> Avairet
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Validation criteria "alphaNumeric" doesn't accept special chars

2008-02-15 Thread avairet

Hi,

Model : "nature" (id int auto-increment PK / label varchar (50) )

var $validate = array(
   'label' => array('alphaNumeric')
);

Create basic functions in NaturesController (view, add, edit)

I launch : "myapp/natures/add"

Add new Nature with label "Article" work fine. Data is saved
correctly.
But add label with special characters, like "é" or "-" or blank:
validation failed!
Error message is: 'The Nature could not be saved. Please, try again.
This field cannot be left blank'!?
I've tested with the 1.2.x.x Nightly builds and 1.2.0.6311 and
1.2.0.5875 releases and the problem remains.

Have you noticed that?

Avairet

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Unit tests and Bake script

2008-02-15 Thread avairet

Hi,

I'm using 1.2.x.x nightly builds.
I'm using Bake script to generate a simple model called "nature" whith
only 2 fields : id (int auto-increment PK) and label (varchar 50).
I'm generating the NaturesController too with the same way.
Bake create automagically Unit tests for my model and my controller,
good!
I launch 'controllers\natures_controller.test.php': it works fine.
But when I launch test for the model: 'models\nature.test.php', there
is an error!

[code]
Individual test case: models\nature.test.php
Query: CREATE TABLE `natures` ( `id` int(10) DEFAULT NULL
auto_increment, `label` varchar(50) NOT NULL );
Error:  Database table natures for model Nature was not found.
1075: Incorrect table definition; there can be only one auto column
and it must be defined as a key
[/code]

The Test Suite shouldn't create "test_natures" table instead of
'natures'?
The problem exists even I write "var $useDbConfig = 'test' " in
"nature.test.php...

Avairet


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Update without deleting HABTM

2008-02-15 Thread Mike Digital Egg

Hi,

I have a HABTM releationship bewteen my Users & Projects table. All I
am trying to to is update the password field in the Users table and
nothing else, but whenever I try this it deletes the info from the
Project table!

I have tried using saveField('password',$password) also
unbindModelarray('hasAndBelongsToMany' => array('Project')) before the
save but it still insists on deleting the Project data.

This seems like a bug to me and is very frustrating.

Anyone got any ideas how to fix it?

Cheers

Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Best practice for working with similar model types (noob question!)

2008-02-15 Thread glastoveteran

Hi all,

I'm building a content managed site with several slightly different
types of record, but all of which feature a common set of fields e.g.
title, summary, description, start_date, end_date, notes, etc.  Some
types of record have one or two extra fields, e.g. location, price,
etc.

I've always wondered what's the best way of approaching this with
cake, or indeed any framework?  To have a single database table,
model, controller etc with a field and logic indicating the record
type?  Or to implement each record type with a different table, model,
controller etc?

I guess the first option of one model involves less repetition, but
how would you handle different record types having a slightly
different validation rules based on the fact that sopme have extra
fields that need to be validated?  Presumably you'd need to use a
model beforeValidate() function instead of the standard validation
array?

The second option would seem to follow the MVC convention a little
better and validation would be easier but seems to have more
repetition.

Looking at this in an object oriented way with classes you would I
guess define a base class with the common characteristics and then
extend / specialise this for other models.  How does that work with
cake?

Thanks all,

Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: DATABASE CONFIG dinâmico ....

2008-02-15 Thread pamp_php

   Thanks dr. Hanniball.




On 15 fev, 09:32, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
> Paulo,
>
> Eu estou usando um tradutor, peço desculpas se é ilegível :-)
>
> Não creio que haja um caminho para este Cake construído utilizando-se
> os métodos, você terá de criar uma base de dados usando o Modelo::
> query (), bem como a abrir o arquivo de configuração com fopen () e
> escrever a nova configuração manualmente.
>
> Espero que irá ajudá-lo de alguma forma.
> Saudações,
> H.
>
> On Feb 14, 7:35 pm, pamp_php <[EMAIL PROTECTED]> wrote:
>
>
>
> > Meu problema é o seguinte:
>
> >      Tenho um método no meu MODEL, onde:
>
> >      1) Através da conexão default, crio um novo banco de dados (o
> > nome do banco de dados é passado dinâmicamente para o meu método);
> >      2) Atribuo privilégios para um usuário, que também é recebido
> > pelo método do meu MODEL.
> >      3) Preciso criar (com os parâmetros recebidos pelo método)  uma
> > nova conexão  na classeDATABASE_CONFIG, ou pelo menos passar os
> > parâmetros de conexão (host, login, password, database);
> >      4)  Tornar essa conexão default; ou setá-la em  $this->useDbConfig;
>
> >      5)  Executar instruções no banco de dados, através dessa
> > conexão.
>
> >       Enfim, é isso.
>
> >       Se alguém puder me ajudar, agradeço.
>
> >       Paulo Augusto M. Pereira.- Ocultar texto entre aspas -
>
> - Mostrar texto entre aspas -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Plugins Rant - All CakePHP experts and software architect called

2008-02-15 Thread Renan Gonçalves
Very interesting!

I always wanna known how much the plugin is "plugable".
If to integrate the application with the plugin is only setting several
OPTIONS or I'll need to make some IMPLEMENTATIONS on the code.

In this way setting several options is that I need. Correct me if I'm wrong.


Yes, "What the next chapter?"

On Thu, Feb 14, 2008 at 10:15 PM, b logica <[EMAIL PROTECTED]> wrote:

>
> On Thu, Feb 14, 2008 at 3:13 PM, MX <[EMAIL PROTECTED]> wrote:
> >
> >  I wrote this paper in the past two days. Comes from a design problem I
> >  had some days ago.
> >  Please read and let discuss this here.
> >
> >  If I am totally wrong please let me know.
> >
> >
> >  http://blog.zerone.weblusa.org/papers/cakephp-plugins/
> >
>
> Not that I'm ranting or anything, but you'd probably get more feedback
> if you at least summarised your arguments here on the list. It's not
> like your "paper" is too big for google to handle.
>
> My only comment at this time is, "What previous chapter?"
>
> >
>


-- 
Renan Gonçalves - Software Engineer
Cell Phone: +55 (11) 8633-6018
MSN: [EMAIL PROTECTED]
Web Site: renangoncalves.com
São Paulo - SP/Brazil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: submit and redirect

2008-02-15 Thread Sebastian

Thanks a lot you guys!
I tried setting up a hidden field "redirect" before ($form-
>hidden), but got a blank screen when trying to submit the form. I
guess the model didn't validate or didn't know what to do with
data[Event][redirect] since my DB-Event table doesn't have a column
"redirect". So I set the hidden field up manually and in the
controller grabbed the "required" variable from the params
arrayand that worked :-)

But grigri's solution looks a lot more elegant, so I guess I'll give
that a try:-)


On 15 Feb., 13:01, grigri <[EMAIL PROTECTED]> wrote:
> I'm not 100% sure this will work, but here goes anyway:
>
> http://bin.cakephp.org/view/818943714
>
> The really annoying bit about this is that you have to process display
> text (the submit image caption/value) as data. In theory, of course,
> you could use a  element and set its value property, but IE
> ignores the value property and sends the innerText instead. Typical.
>
> Hope this helps
>
> On Feb 15, 11:27 am, Sebastian <[EMAIL PROTECTED]> wrote:
>
> > Hi y'all,
>
> > I got a problem. I have a form that contains all kinds of data for a
> > Model "Event". That Event has multiple HABTM relationships with models
> > like "Promoters" or "Bands", which are displayed as select fields in
> > the form.
> > Now in order to give the user the opportunity to e.g. add a "Band"
> > that is not yet in the select field, I want to place a link "Add Band"
> > beneath the "Bands" listing that submits the form and then temporarily
> > redirects the user to the Add-View of the  bands_controller. Once he/
> > she has added the new Band there, he/she shall be redirected to the
> > initial "Event"-Edit view.
> > I managed to create links that pass the Event's id as a parameter to
> > the Band's add function so that I can redirect back to the Edit-Event
> > page, after the user has added the Band.
> > However, what I want is to submit the form, before I redirect off to
> > the Band's input form.
>
> > So the question is now: How can I submit a form and pass a redirect-
> > variable to the controller's edit-function so that I can redirect
> > individually?
>
> > Regards,
>
> > Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: creating dynamic routing

2008-02-15 Thread Voyager2K

thanks for interesting ideas, but me now mostly liked my version :)
just add to URL "MyPages/show/" and rerun __getController();
$_GET['url'] = 'sitepages/index/'.$_GET['url'];

imho defects :

>> Router::connect('/*', array('controller' => 'MyPages', 'action' => 'show'));
>> But remember to define _before_ it a route for each controller in your app. 
>> Ex:
>> Router::connect('/users/:action/*', array('controller' => 'users'));

here me does not liked manually setting exsits controllers...

>> Or implement something like this: 
>> http://snook.ca/archives/cakephp/static_pages_cakephp12/

by logic not so good to hide controller "redirect" to error hadler...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



fixed: re. bakery article 'p28n, the top to bottom persistent internationalization tutorial.'

2008-02-15 Thread leo

Woops, I found a space after a ?> ... got to watch out for those
blighters.

On 15 Feb, 13:37, leo <[EMAIL PROTECTED]> wrote:
> I've been trying to implement this in 1.2, but I always get a headers
> already sent error. Has anyone had any success with it? Does anyone
> know the answer to my problem?
>
> I've already spent the morning picking it to pieces and now I have to
> move on to something else.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



re. bakery article 'p28n, the top to bottom persistent internationalization tutorial.'

2008-02-15 Thread leo

I've been trying to implement this in 1.2, but I always get a headers
already sent error. Has anyone had any success with it? Does anyone
know the answer to my problem?

I've already spent the morning picking it to pieces and now I have to
move on to something else.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



i18n translation of related models

2008-02-15 Thread senser

Hi,

I'm using CakePHP to develop a multi-language CMS and have troubles
with translate baheviour.

For example I have model named "Offer" and related model "Category" as
relation is "Offer"--belongsTo-->"Category". I set up i18n sql tables
and using "var $actAs" in models translate the content, but when I try
to fetch data form table "Offers" with relevant "Category" I just
receive category_id, but not translated category content.

I read this article in Frequent Discussion:
http://groups.google.com/group/cake-php/browse_thread/thread/889c63d32cfdf69/925ac611e22c3359?q=i18n+belongsto&lnk=ol&#
and there is post were jitka says that translation makes hasMany
relation to retrieve the content of relatede models (in my case -
translated version of "Category").

Am I wrong or skip something ???
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: submit and redirect

2008-02-15 Thread grigri

I'm not 100% sure this will work, but here goes anyway:

http://bin.cakephp.org/view/818943714

The really annoying bit about this is that you have to process display
text (the submit image caption/value) as data. In theory, of course,
you could use a  element and set its value property, but IE
ignores the value property and sends the innerText instead. Typical.

Hope this helps

On Feb 15, 11:27 am, Sebastian <[EMAIL PROTECTED]> wrote:
> Hi y'all,
>
> I got a problem. I have a form that contains all kinds of data for a
> Model "Event". That Event has multiple HABTM relationships with models
> like "Promoters" or "Bands", which are displayed as select fields in
> the form.
> Now in order to give the user the opportunity to e.g. add a "Band"
> that is not yet in the select field, I want to place a link "Add Band"
> beneath the "Bands" listing that submits the form and then temporarily
> redirects the user to the Add-View of the  bands_controller. Once he/
> she has added the new Band there, he/she shall be redirected to the
> initial "Event"-Edit view.
> I managed to create links that pass the Event's id as a parameter to
> the Band's add function so that I can redirect back to the Edit-Event
> page, after the user has added the Band.
> However, what I want is to submit the form, before I redirect off to
> the Band's input form.
>
> So the question is now: How can I submit a form and pass a redirect-
> variable to the controller's edit-function so that I can redirect
> individually?
>
> Regards,
>
> Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Primary Keys

2008-02-15 Thread Adam Royle

Try my suggestion and do a few tests. Don't see why it wouldn't.

Adam

On Feb 15, 9:57 pm, villas <[EMAIL PROTECTED]> wrote:
> > You could set up a "shadow" field in the table to store the human
> > readable form of theprimarykey, maintained on a trigger.
>
> That's an idea that I hadn't considered.
>
> However, I'd only consider this route if someone confirms that my user-
> friendly primary keys are not recommended in Cake for some reason.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Primary Keys

2008-02-15 Thread villas

> You could set up a "shadow" field in the table to store the human
> readable form of theprimarykey, maintained on a trigger.

That's an idea that I hadn't considered.

However, I'd only consider this route if someone confirms that my user-
friendly primary keys are not recommended in Cake for some reason.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: submit and redirect

2008-02-15 Thread Adam Royle

You should look at ajax to help create something like this to prevent
leaving the page.

Otherwise you store information in your session, or cookies, or pass
them through hidden fields, etc.

On Feb 15, 9:27 pm, Sebastian <[EMAIL PROTECTED]> wrote:
> Hi y'all,
>
> I got a problem. I have a form that contains all kinds of data for a
> Model "Event". That Event has multiple HABTM relationships with models
> like "Promoters" or "Bands", which are displayed as select fields in
> the form.
> Now in order to give the user the opportunity to e.g. add a "Band"
> that is not yet in the select field, I want to place a link "Add Band"
> beneath the "Bands" listing that submits the form and then temporarily
> redirects the user to the Add-View of the  bands_controller. Once he/
> she has added the new Band there, he/she shall be redirected to the
> initial "Event"-Edit view.
> I managed to create links that pass the Event's id as a parameter to
> the Band's add function so that I can redirect back to the Edit-Event
> page, after the user has added the Band.
> However, what I want is to submit the form, before I redirect off to
> the Band's input form.
>
> So the question is now: How can I submit a form and pass a redirect-
> variable to the controller's edit-function so that I can redirect
> individually?
>
> Regards,
>
> Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cakephp pluralisation doesnt work with my scaffolds..

2008-02-15 Thread Dardo Sordi Bogado

Try setting it on config/inflections.php

On Thu, Feb 14, 2008 at 2:30 PM, blain57 <[EMAIL PROTECTED]> wrote:
>
>  Hi all,
>
>  simple example:
>
>  i make a ticket_activities table
>  i make a ticket_activity.php file model with:
>
>  class TicketActivity extends AppModel
>  {
> var $name = 'TicketActivity';
>  }
>
>  and a ticket_activities_controller.php with:
>
>  class TicketActivitiesController extends AppController
>  {
> var $scaffold;
>  }
>
>  and i get the following errors:
>
>  Notice: Trying to get property of non-object
>  Warning: Invalid argument supplied for foreach()
>
>  Scaffolding works with tables without underscores tho
>
>  I am running cake on a windows 2003 server with iis6 and php5 but
>  without rewrite.
>
>  Thanx in advance.
>
>  >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: creating dynamic routing

2008-02-15 Thread Adam Royle

Or implement something like this: 
http://snook.ca/archives/cakephp/static_pages_cakephp12/

On Feb 15, 9:08 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> An easy way to do it is setup a catch all route:
>
> Router::connect('/*', array('controller' => 'MyPages', 'action' => 'show'));
>
> But remember to define _before_ it a route for each controller in your app. 
> Ex:
>
> Router::connect('/users/:action/*', array('controller' => 'users'));
> ...
>
> HTH,
> - Dardo Sordi.
>
> On Fri, Feb 15, 2008 at 6:52 AM, Voyager2K <[EMAIL PROTECTED]> wrote:
>
> >  Lets i post my look at this implementation:
> >  adding to dispatch one more condition if (!is_object($controller))
>
> >  dispatcher.php
>
> > function dispatch($url = null, $additionalParams = array()) {
> > if ($this->base === false) {
> > $this->base = $this->baseUrl();
> > }
> > if ($url !== null) {
> > $_GET['url'] = $url;
> > }
>
> > $url = $this->getUrl();
> > $this->here = $this->base . '/' . $url;
>
> > if ($this->cached($url)) {
> > exit();
> > }
>
> > $this->params = array_merge($this->parseParams($url),
> >  $additionalParams);
>
> > $controller = $this->__getController();
>
> > // HANDLE DB TREE
> > if (!is_object($controller)) {
> > $_GET['url'] = 'sitepages/index/'.$_GET['url'];
> > $url = $this->getUrl();
> > $this->here = $this->base . '/' . $url;
>
> > if ($this->cached($url)) {
> > exit();
> > }
> > $this->params = 
> > array_merge($this->parseParams($url),
> >  $additionalParams);
> > $controller = $this->__getController();
>
> > }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: DATABASE CONFIG dinâmico ....

2008-02-15 Thread dr. Hannibal Lecter

Paulo,

Eu estou usando um tradutor, peço desculpas se é ilegível :-)

Não creio que haja um caminho para este Cake construído utilizando-se
os métodos, você terá de criar uma base de dados usando o Modelo::
query (), bem como a abrir o arquivo de configuração com fopen () e
escrever a nova configuração manualmente.

Espero que irá ajudá-lo de alguma forma.
Saudações,
H.

On Feb 14, 7:35 pm, pamp_php <[EMAIL PROTECTED]> wrote:
> Meu problema é o seguinte:
>
>  Tenho um método no meu MODEL, onde:
>
>  1) Através da conexão default, crio um novo banco de dados (o
> nome do banco de dados é passado dinâmicamente para o meu método);
>  2) Atribuo privilégios para um usuário, que também é recebido
> pelo método do meu MODEL.
>  3) Preciso criar (com os parâmetros recebidos pelo método)  uma
> nova conexão  na classe DATABASE_CONFIG, ou pelo menos passar os
> parâmetros de conexão (host, login, password, database);
>  4)  Tornar essa conexão default; ou setá-la em  $this->useDbConfig;
>
>  5)  Executar instruções no banco de dados, através dessa
> conexão.
>
>   Enfim, é isso.
>
>   Se alguém puder me ajudar, agradeço.
>
>   Paulo Augusto M. Pereira.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



submit and redirect

2008-02-15 Thread Sebastian

Hi y'all,

I got a problem. I have a form that contains all kinds of data for a
Model "Event". That Event has multiple HABTM relationships with models
like "Promoters" or "Bands", which are displayed as select fields in
the form.
Now in order to give the user the opportunity to e.g. add a "Band"
that is not yet in the select field, I want to place a link "Add Band"
beneath the "Bands" listing that submits the form and then temporarily
redirects the user to the Add-View of the  bands_controller. Once he/
she has added the new Band there, he/she shall be redirected to the
initial "Event"-Edit view.
I managed to create links that pass the Event's id as a parameter to
the Band's add function so that I can redirect back to the Edit-Event
page, after the user has added the Band.
However, what I want is to submit the form, before I redirect off to
the Band's input form.

So the question is now: How can I submit a form and pass a redirect-
variable to the controller's edit-function so that I can redirect
individually?


Regards,

Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: creating dynamic routing

2008-02-15 Thread Dardo Sordi Bogado

An easy way to do it is setup a catch all route:

Router::connect('/*', array('controller' => 'MyPages', 'action' => 'show'));

But remember to define _before_ it a route for each controller in your app. Ex:

Router::connect('/users/:action/*', array('controller' => 'users'));
...

HTH,
- Dardo Sordi.

On Fri, Feb 15, 2008 at 6:52 AM, Voyager2K <[EMAIL PROTECTED]> wrote:
>
>  Lets i post my look at this implementation:
>  adding to dispatch one more condition if (!is_object($controller))
>
>  dispatcher.php
>
> function dispatch($url = null, $additionalParams = array()) {
> if ($this->base === false) {
> $this->base = $this->baseUrl();
> }
> if ($url !== null) {
> $_GET['url'] = $url;
> }
>
> $url = $this->getUrl();
> $this->here = $this->base . '/' . $url;
>
> if ($this->cached($url)) {
> exit();
> }
>
> $this->params = array_merge($this->parseParams($url),
>  $additionalParams);
>
> $controller = $this->__getController();
>
> // HANDLE DB TREE
> if (!is_object($controller)) {
> $_GET['url'] = 'sitepages/index/'.$_GET['url'];
> $url = $this->getUrl();
> $this->here = $this->base . '/' . $url;
>
> if ($this->cached($url)) {
> exit();
> }
> $this->params = array_merge($this->parseParams($url),
>  $additionalParams);
> $controller = $this->__getController();
>
>
> }
>  >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Has and belongs to many association question

2008-02-15 Thread Dardo Sordi Bogado

Don't use HABTM, make a full model for the table, then change the
associations to hasMany/belongsTo.

HTH,
- Dardo Sordi.

On Fri, Feb 15, 2008 at 12:26 AM, Snadly <[EMAIL PROTECTED]> wrote:
>
>  For this question, lets assume I have 3 models: A, B, and C.
>
>
>  I have a HABTM relationship setup between two models, A and B.
>
>  The many to many table looks like this:
>  id,
>  a.id,
>  b.id,
>  c.id <--- This can be NULL or it can be a record out of model C.
>
>  What I want to do is to have the Model C record loaded if the value is
>  not NULL. I have tried changing the level of recursion, but the
>  problem is that the HABTM relationship doesn't know that c.id is a
>  model that can be loaded and I don't know how to tell it such.
>
>
>  Any advice?
>
>
>  Thanks.
>
>
>  >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Primary Keys

2008-02-15 Thread duncan_m

You could set up a "shadow" field in the table to store the human
readable form of the primary key, maintained on a trigger. Your users
get their pretty field values and don't need to join and cakePHP still
happily works with its expected "id" integer field..?

Dunc.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth 1.2 - login only if user state = activated?

2008-02-15 Thread Tim W

I just tried it and it works perfectly, thank you Grigri. And wow,
quick replies! :)

On Feb 15, 11:51 pm, grigri <[EMAIL PROTECTED]> wrote:
> Just set $this->Auth->userScope = array('User.state_id' => WHATEVER);
> in your controller's beforeFilter callback.
>
> On Feb 15, 10:43 am, Tim W <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > My user table/model has a state_id field. I'd like to configure Auth
> > so that it only lets people login is the state is a certain value. Is
> > there an easy way to do this?
>
> > Two lines in auth.php suggest it should be possible
>
> > 38: $conditions = $this->userScope;  // (previously $conditions is a
> > null parameter)
> > 77: $data = $model->find(array_merge($find, $conditions), null, null,
> > -1);
>
> > If I could work out how to pass a condition in that would do the job.
> > Has anyone done it?
>
> > Thanks
>
> > Tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth 1.2 - login only if user state = activated?

2008-02-15 Thread Tim W

That sound easy, i'll give it ago, thanks Grigri :)

On Feb 15, 11:51 pm, grigri <[EMAIL PROTECTED]> wrote:
> Just set $this->Auth->userScope = array('User.state_id' => WHATEVER);
> in your controller's beforeFilter callback.
>
> On Feb 15, 10:43 am, Tim W <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > My user table/model has a state_id field. I'd like to configure Auth
> > so that it only lets people login is the state is a certain value. Is
> > there an easy way to do this?
>
> > Two lines in auth.php suggest it should be possible
>
> > 38: $conditions = $this->userScope;  // (previously $conditions is a
> > null parameter)
> > 77: $data = $model->find(array_merge($find, $conditions), null, null,
> > -1);
>
> > If I could work out how to pass a condition in that would do the job.
> > Has anyone done it?
>
> > Thanks
>
> > Tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth 1.2 - login only if user state = activated?

2008-02-15 Thread Tim W

Thanks Dardo. I'm still a beginner at Auth, i'd really appreciate a
line of code and a suggestion where it should go. The login() method
of my UserController is never called during the login process,
execution jumps straight to the login method in auth.php.

On Feb 15, 11:48 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]>
wrote:
> Use AuthComponent::$userScope = array() // accepts conditions in the
> same way that Model::findAll()
>
> On Fri, Feb 15, 2008 at 8:43 AM, Tim W <[EMAIL PROTECTED]> wrote:
>
> >  Hi all,
>
> >  My user table/model has a state_id field. I'd like to configure Auth
> >  so that it only lets people login is the state is a certain value. Is
> >  there an easy way to do this?
>
> >  Two lines in auth.php suggest it should be possible
>
> >  38: $conditions = $this->userScope;  // (previously $conditions is a
> >  null parameter)
> >  77: $data = $model->find(array_merge($find, $conditions), null, null,
> >  -1);
>
> >  If I could work out how to pass a condition in that would do the job.
> >  Has anyone done it?
>
> >  Thanks
>
> >  Tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth 1.2 - login only if user state = activated?

2008-02-15 Thread grigri

Just set $this->Auth->userScope = array('User.state_id' => WHATEVER);
in your controller's beforeFilter callback.

On Feb 15, 10:43 am, Tim W <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> My user table/model has a state_id field. I'd like to configure Auth
> so that it only lets people login is the state is a certain value. Is
> there an easy way to do this?
>
> Two lines in auth.php suggest it should be possible
>
> 38: $conditions = $this->userScope;  // (previously $conditions is a
> null parameter)
> 77: $data = $model->find(array_merge($find, $conditions), null, null,
> -1);
>
> If I could work out how to pass a condition in that would do the job.
> Has anyone done it?
>
> Thanks
>
> Tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth 1.2 - login only if user state = activated?

2008-02-15 Thread Dardo Sordi Bogado

Use AuthComponent::$userScope = array() // accepts conditions in the
same way that Model::findAll()

On Fri, Feb 15, 2008 at 8:43 AM, Tim W <[EMAIL PROTECTED]> wrote:
>
>  Hi all,
>
>  My user table/model has a state_id field. I'd like to configure Auth
>  so that it only lets people login is the state is a certain value. Is
>  there an easy way to do this?
>
>  Two lines in auth.php suggest it should be possible
>
>  38: $conditions = $this->userScope;  // (previously $conditions is a
>  null parameter)
>  77: $data = $model->find(array_merge($find, $conditions), null, null,
>  -1);
>
>  If I could work out how to pass a condition in that would do the job.
>  Has anyone done it?
>
>  Thanks
>
>  Tim
>  >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Primary Keys

2008-02-15 Thread Dardo Sordi Bogado

Yo can define which column is used in the join, see:

http://manual.cakephp.org/chapter/models
http://tempdocs.cakephp.org/#TOC82250
http://book.cakephp.org/view/66/models#78-associations

On Fri, Feb 15, 2008 at 7:21 AM, villas <[EMAIL PROTECTED]> wrote:
>
>  The end-user reporting application is indeed 3rd Party.  It only takes
>  a few seconds to teach users how to make nicely formatted reports from
>  tables.  However, although IMO the dialogs for joining tables are
>  fairly straightforward to anyone knowing SQL,  it can be quite tricky
>  for those who are unenlightened.  Hence my desire for primary keys
>  which are meaningful.
>
>  From your answer it seems that Cake would have no problem with my
>  idea.  One of my doubts was whether anyone would propose the
>  following:
>
>  Contacts
>  idLastnameContacttype_ref
>
> ------
>  1 FredTELE
>  2 Joe  MEET
>  3 Alan MAIL
>  etc
>
>  Contacttypes
>  idRef   Name Status
>  ----  ---  --
>  1 TELE   Telephone Call A
>  2 MEET  Meeting   B
>  3 MAILEmail  A
>  etc
>
>  Note that Contacttype_ref would be unique, not null, index.  But then
>  the Cake magic would disappear?
>
>  Sorry for this elementary question,  but the DB setup is important to
>  get right at the outset and the 'outset' is where noobies like me are
>  least knowledgeable.
>
>
>
>  On Feb 14, 5:58 pm, Baz <[EMAIL PROTECTED]> wrote:
>  > I'm curious to see some of the other responses, but here's mine.
>  >
>  > I don't think I understand what you're trying to accomplish.
>  > If you build an application in Cake, then no end user sees the resulting
>  > SQL, what the keys are shouldn't matter.
>  >
>  > What I _think_ you're saying is that OUTSIDE of Cake, you're using a third
>  > party application to do reports with joins? If so, I don't quite understand
>  > how users can join tables (on char keys or numeric) if they don't know what
>  > they are doing...Either this 3rd party application knows how to join or it
>  > doesn't.
>  >
>  > But regardless of what your app. can and cannot do, this is not a CakePHP
>  > specific problem. As far as I am aware, your primary keys can be anything 
> of
>  > your choosing. Obvious, if it's not auto-incrementing then you are
>  > personally going to have to manage how they get set when you add
>  > Contacttypes, for example. It would be as simple as putting in the field in
>  > the form.
>  >
>  > If not, you'll have SQL errors. This would be a problem in any other type 
> of
>  > application.
>  >
>  > Again, your intent is a bit vague to me, but regardless the only constraint
>  > that I am aware of with CakePHP is the the primary key cannot be composite.
>  >
>
>
> > On Thu, Feb 14, 2008 at 11:44 AM, villas <[EMAIL PROTECTED]> wrote:
>  >
>  > > I notice that everyone using Cake seems to use autoincrementing
>  > > integer primary keys. However this means you always have to join the
>  > > code files for all queries and reports because the keys don't mean
>  > > anything (unless you can memorize lots of numbers).
>  >
>  > > In the past I have successfully used more recognisable alphanumeric
>  > > primary keys,  and I appreciate that one must manage these manually
>  > > but it makes end-user reporting much more intuitive.
>  >
>  > > e.g.
>  >
>  > > Contacts
>  > > idLastnameContacttype_id
>  > > ------
>  > > 1 FredTELE
>  > > 2 Joe  MEET
>  > > 3 Alan MAIL
>  > > etc
>  >
>  > > Contacttypes
>  > > idName Status
>  > > ------  --
>  > > TELE   Telephone Call A
>  > > MEET  Meeting   B
>  > > MAILEmail  A
>  > > etc
>  >
>  > > The users are using an end-user reporting application and will be able
>  > > to make a simple query on the Contacts table which will provide the
>  > > info he needs without making any joins.  In fact the user wouldn't
>  > > need to know about joins unless for example he needs to get the
>  > > 'status' in which case his supervisor can assist.
>  >
>  > > My questions are:
>  > > 1.  Is the 'cost' of having non-standard primary keys too great a
>  > > price to pay in terms of losing some of Cake's built-in power?  I'm
>  > > not even sure what functionality we might miss.
>  >
>  > > 2.  Clearly the above tables are greatly simplified;  the real-life
>  > > tables would require many joins.  If I don't use the alphanumeric
>  > > keys, I would have to go around and teach a lot of people how to join
>  > > up the tables to make their reports.  Does everyone advocate teaching
>  > > end-users about the principles of the SQL SELECT?
>  >
>  > > I am sur

Auth 1.2 - login only if user state = activated?

2008-02-15 Thread Tim W

Hi all,

My user table/model has a state_id field. I'd like to configure Auth
so that it only lets people login is the state is a certain value. Is
there an easy way to do this?

Two lines in auth.php suggest it should be possible

38: $conditions = $this->userScope;  // (previously $conditions is a
null parameter)
77: $data = $model->find(array_merge($find, $conditions), null, null,
-1);

If I could work out how to pass a condition in that would do the job.
Has anyone done it?

Thanks

Tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



bakery article publishing - how long does one need to wait?

2008-02-15 Thread dr. Hannibal Lecter

Hi all,

I've posted an article about Markdown and dp.SyntaxHighligher to the
bakery; it's been a while and the article is still not published. I
was just wondering is this a standard issue or do I need to correct
something in the article itself? (I apologize if this is the wrong
place to post, don't know any better..)

Thanks,
H.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Primary Keys

2008-02-15 Thread Adam Royle

AFAIK cake will accept a string as a primary key if your table is
setup like that, however I think it creates a UUID when inserting a
new row, but you could probably override this if you need to.

I've not used this functionality so I can't verify that it works
flawlessly.

Cheers,
Adam

On Feb 15, 7:21 pm, villas <[EMAIL PROTECTED]> wrote:
> The end-user reporting application is indeed 3rd Party.  It only takes
> a few seconds to teach users how to make nicely formatted reports from
> tables.  However, although IMO the dialogs for joining tables are
> fairly straightforward to anyone knowing SQL,  it can be quite tricky
> for those who are unenlightened.  Hence my desire for primary keys
> which are meaningful.
>
> From your answer it seems that Cake would have no problem with my
> idea.  One of my doubts was whether anyone would propose the
> following:
>
> Contacts
> idLastnameContacttype_ref
> ------
> 1 FredTELE
> 2 Joe  MEET
> 3 Alan MAIL
> etc
>
> Contacttypes
> idRef   Name Status
> ----  ---  --
> 1 TELE   Telephone Call A
> 2 MEET  Meeting   B
> 3 MAILEmail  A
> etc
>
> Note that Contacttype_ref would be unique, not null, index.  But then
> the Cake magic would disappear?
>
> Sorry for this elementary question,  but the DB setup is important to
> get right at the outset and the 'outset' is where noobies like me are
> least knowledgeable.
>
> On Feb 14, 5:58 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > I'm curious to see some of the other responses, but here's mine.
>
> > I don't think I understand what you're trying to accomplish.
> > If you build an application in Cake, then no end user sees the resulting
> > SQL, what the keys are shouldn't matter.
>
> > What I _think_ you're saying is that OUTSIDE of Cake, you're using a third
> > party application to do reports with joins? If so, I don't quite understand
> > how users can join tables (on char keys or numeric) if they don't know what
> > they are doing...Either this 3rd party application knows how to join or it
> > doesn't.
>
> > But regardless of what your app. can and cannot do, this is not a CakePHP
> > specific problem. As far as I am aware, your primary keys can be anything of
> > your choosing. Obvious, if it's not auto-incrementing then you are
> > personally going to have to manage how they get set when you add
> > Contacttypes, for example. It would be as simple as putting in the field in
> > the form.
>
> > If not, you'll have SQL errors. This would be a problem in any other type of
> > application.
>
> > Again, your intent is a bit vague to me, but regardless the only constraint
> > that I am aware of with CakePHP is the the primary key cannot be composite.
>
> > On Thu, Feb 14, 2008 at 11:44 AM, villas <[EMAIL PROTECTED]> wrote:
>
> > > I notice that everyone using Cake seems to use autoincrementing
> > > integer primary keys. However this means you always have to join the
> > > code files for all queries and reports because the keys don't mean
> > > anything (unless you can memorize lots of numbers).
>
> > > In the past I have successfully used more recognisable alphanumeric
> > > primary keys,  and I appreciate that one must manage these manually
> > > but it makes end-user reporting much more intuitive.
>
> > > e.g.
>
> > > Contacts
> > > idLastnameContacttype_id
> > > ------
> > > 1 FredTELE
> > > 2 Joe  MEET
> > > 3 Alan MAIL
> > > etc
>
> > > Contacttypes
> > > idName Status
> > > ------  --
> > > TELE   Telephone Call A
> > > MEET  Meeting   B
> > > MAILEmail  A
> > > etc
>
> > > The users are using an end-user reporting application and will be able
> > > to make a simple query on the Contacts table which will provide the
> > > info he needs without making any joins.  In fact the user wouldn't
> > > need to know about joins unless for example he needs to get the
> > > 'status' in which case his supervisor can assist.
>
> > > My questions are:
> > > 1.  Is the 'cost' of having non-standard primary keys too great a
> > > price to pay in terms of losing some of Cake's built-in power?  I'm
> > > not even sure what functionality we might miss.
>
> > > 2.  Clearly the above tables are greatly simplified;  the real-life
> > > tables would require many joins.  If I don't use the alphanumeric
> > > keys, I would have to go around and teach a lot of people how to join
> > > up the tables to make their reports.  Does everyone advocate teaching
> > > end-users about the principles of the SQL SELECT?
>
> > > I am sure that I'm not the first to have this dilemma,  but maybe

Re: how to getting started ???

2008-02-15 Thread Miki


> My "Hello world" is ok now. But when I try to work with database, html
> out put always have a table with query string and some infomation 
>
> How to remove it. I want to have a layout same CodeIgniter or ZF.
> I know cakePHP have more helpful but I dont want see it in my
> website 
>

Hello, im very newbie too, but i think you can change debug value to 0
(zero, production) in the config/core.php

Miki
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: behavior acts_as_list

2008-02-15 Thread dr. Hannibal Lecter

Sorry for the off-topic, but I'd like to cast my vote to quote Baz in
a very *very* visible place on this group (home page or such).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Primary Keys

2008-02-15 Thread villas

The end-user reporting application is indeed 3rd Party.  It only takes
a few seconds to teach users how to make nicely formatted reports from
tables.  However, although IMO the dialogs for joining tables are
fairly straightforward to anyone knowing SQL,  it can be quite tricky
for those who are unenlightened.  Hence my desire for primary keys
which are meaningful.

>From your answer it seems that Cake would have no problem with my
idea.  One of my doubts was whether anyone would propose the
following:

Contacts
idLastnameContacttype_ref
------
1 FredTELE
2 Joe  MEET
3 Alan MAIL
etc

Contacttypes
idRef   Name Status
----  ---  --
1 TELE   Telephone Call A
2 MEET  Meeting   B
3 MAILEmail  A
etc

Note that Contacttype_ref would be unique, not null, index.  But then
the Cake magic would disappear?

Sorry for this elementary question,  but the DB setup is important to
get right at the outset and the 'outset' is where noobies like me are
least knowledgeable.


On Feb 14, 5:58 pm, Baz <[EMAIL PROTECTED]> wrote:
> I'm curious to see some of the other responses, but here's mine.
>
> I don't think I understand what you're trying to accomplish.
> If you build an application in Cake, then no end user sees the resulting
> SQL, what the keys are shouldn't matter.
>
> What I _think_ you're saying is that OUTSIDE of Cake, you're using a third
> party application to do reports with joins? If so, I don't quite understand
> how users can join tables (on char keys or numeric) if they don't know what
> they are doing...Either this 3rd party application knows how to join or it
> doesn't.
>
> But regardless of what your app. can and cannot do, this is not a CakePHP
> specific problem. As far as I am aware, your primary keys can be anything of
> your choosing. Obvious, if it's not auto-incrementing then you are
> personally going to have to manage how they get set when you add
> Contacttypes, for example. It would be as simple as putting in the field in
> the form.
>
> If not, you'll have SQL errors. This would be a problem in any other type of
> application.
>
> Again, your intent is a bit vague to me, but regardless the only constraint
> that I am aware of with CakePHP is the the primary key cannot be composite.
>
> On Thu, Feb 14, 2008 at 11:44 AM, villas <[EMAIL PROTECTED]> wrote:
>
> > I notice that everyone using Cake seems to use autoincrementing
> > integer primary keys. However this means you always have to join the
> > code files for all queries and reports because the keys don't mean
> > anything (unless you can memorize lots of numbers).
>
> > In the past I have successfully used more recognisable alphanumeric
> > primary keys,  and I appreciate that one must manage these manually
> > but it makes end-user reporting much more intuitive.
>
> > e.g.
>
> > Contacts
> > idLastnameContacttype_id
> > ------
> > 1 FredTELE
> > 2 Joe  MEET
> > 3 Alan MAIL
> > etc
>
> > Contacttypes
> > idName Status
> > ------  --
> > TELE   Telephone Call A
> > MEET  Meeting   B
> > MAILEmail  A
> > etc
>
> > The users are using an end-user reporting application and will be able
> > to make a simple query on the Contacts table which will provide the
> > info he needs without making any joins.  In fact the user wouldn't
> > need to know about joins unless for example he needs to get the
> > 'status' in which case his supervisor can assist.
>
> > My questions are:
> > 1.  Is the 'cost' of having non-standard primary keys too great a
> > price to pay in terms of losing some of Cake's built-in power?  I'm
> > not even sure what functionality we might miss.
>
> > 2.  Clearly the above tables are greatly simplified;  the real-life
> > tables would require many joins.  If I don't use the alphanumeric
> > keys, I would have to go around and teach a lot of people how to join
> > up the tables to make their reports.  Does everyone advocate teaching
> > end-users about the principles of the SQL SELECT?
>
> > I am sure that I'm not the first to have this dilemma,  but maybe
> > someone might give me a bit of advice based on their own experience?
>
> > D
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: i18n language specific URLs

2008-02-15 Thread leo

I've tried it now and Dieter's approach works okay on 1.2. The only
change I had to make was the name of $from_url, which now becomes
$fromUrl:



In the translate table, all the languages (I have Spanish, Catalan and
English) are listed together:

$translatetable = array(
'geobloc' => 'posts',  // Catalan -> English
'geoblog' => 'posts'   // Spanish -> English
);

I've read all the arguments for not translating URLs, but the fact
remains that people DO read them and in this part of Spain people can
be quite sensitive about what appears in which language.

At the moment I'm working with the cake message system which is a
dream. I don't know whether I can implement the message system within
the routing...I'll try that later.

L

On 14 Feb, 17:01, r0sk <[EMAIL PROTECTED]> wrote:
> 2008/2/14, leo <[EMAIL PROTECTED]>:
>
>
>
> > In his article at:
> >http://bakery.cakephp.org/articles/view/diy-international-i18n-urls-i...
> > Dieter Plaetinck discusses translation of URLs for CakePHP 1.1x. He
> > alludes to a simpler more integrated way to do this in 1.2, but the
> > only documentation I can find on this appears more complex and doesn't
> > really deal with URL translation, more message internationalization.
>
> > Dieter's approach for 1.1 looks simple enough. Is there any reason it
> > wouldn't work in 1.2? Or can anyone point me at a suitable article/
> > tutorial?
>
> > Thanks
>
> I'm on same problem, it seems that the new CookBook has got a well language
> specific URL's, maybe we can see the source code and learn how to do. Any
> tip?
>
> --http://www.userlinux.nethttp://7throot.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: creating dynamic routing

2008-02-15 Thread Voyager2K

Lets i post my look at this implementation:
adding to dispatch one more condition if (!is_object($controller))

dispatcher.php

function dispatch($url = null, $additionalParams = array()) {
if ($this->base === false) {
$this->base = $this->baseUrl();
}
if ($url !== null) {
$_GET['url'] = $url;
}

$url = $this->getUrl();
$this->here = $this->base . '/' . $url;

if ($this->cached($url)) {
exit();
}

$this->params = array_merge($this->parseParams($url),
$additionalParams);

$controller = $this->__getController();

// HANDLE DB TREE
if (!is_object($controller)) {
$_GET['url'] = 'sitepages/index/'.$_GET['url'];
$url = $this->getUrl();
$this->here = $this->base . '/' . $url;

if ($this->cached($url)) {
exit();
}
$this->params = array_merge($this->parseParams($url),
$additionalParams);
$controller = $this->__getController();
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: List generated

2008-02-15 Thread Adam Royle

The find('list') returns an array containing the id and displayField
(ie. a field named "title" or "name") for the model.

Use pr() to see the structure it creates

$people = $this->Work->Person->find('list);
pr($people);

Then in your baked view you should see something like this.

echo $form->input('Person');

or it could be:

echo $form->input('person_id');

This will create a select list populated with the contents of the
$people array passed to your view.

Hope this explanation has been helpful.

Cheers,
Adam


On Feb 15, 4:38 pm, "sixs" <[EMAIL PROTECTED]> wrote:
> Hi,
> I'm using BAKE and I get some code that refers to list.
> 
>  function add() {
>   if (!empty($this->data)) {
>$this->Work->create();
>if ($this->Work->save($this->data)) {
> $this->Session->setFlash(__('The Work has been saved', true));
> $this->redirect(array('action'=>'index'));
>} else {
> $this->Session->setFlash(__('The Work could not be saved. Please, try 
> again.', true));
>}
>   }
>   $people = $this->Work->Person->find('list);
>   $this->set(compact('people'));
> =
> What is the list that this line refers to in the find???
>  $people = $this->Work->Person->find('list);
>  ^^^
>
> Jim
> Thanks for any help!!!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: App Organization

2008-02-15 Thread Adam Royle

Look in app/bootstrap.php and you will find this comment. Let's you
define extra paths for your classes. Never used it but I'm guessing
this was what gwoo was getting at.

/**
 * The settings below can be used to set additional paths to models,
views and controllers.
 * This is related to Ticket #470 (https://trac.cakephp.org/ticket/
470)
 *
 * $modelPaths = array('full path to models', 'second full path to
models', 'etc...');
 * $viewPaths = array('this path to views', 'second full path to
views', 'etc...');
 * $controllerPaths = array('this path to controllers', 'second full
path to controllers', 'etc...');
 *
 */

Cheers,
Adam

On Feb 15, 3:12 am, Steve <[EMAIL PROTECTED]> wrote:
> This was brought up before, but never revisited.
>
> Here is the post that summed it up for me:
>
> "This is the first I've heard of this, although I can see the sense in
> gwoo's words. Plugins need to be independant, or they can't be easily
> distributable from app to app or developer to developer. So, I guess
> gwoo is right, I had intended to use plugins to organize parts of a
> larger application. Sounds like many others also thought this way." -
> keymaster
>
> I'm also working on a large project and ideally I'd like to organize
> the project based on package, where each package has it's own folder
> structure of model / view / controller.
>
> Gwoo has addressed this and said it can be done through the
> bootstrap.php, but never really specified how. This is what he wrote:
>
> "Correct me if I am wrong, but it seems some are using plugins to
> organize parts of a larger application. To me, you are on a slippery
> slope here to basically negating the whole benefit of a plugin and
> just making it more work on yourself. Using the config/bootstrap.php
> to organize your MVC requires a lot less code and should yield the
> same benefits.
>
> That said, there are some changes in the works that may allow this
> functionality. So time will tell, but at least you know why it works
> the way it does right now. "
>
> I was wondering if there is any new information on this.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is JQuery replacing Prototype in cake?

2008-02-15 Thread Julio Protzek

There's no need to create a JQuery helper for CakePHP.
All you need is just start using it.

---
Julio Vinicius Protzek

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: creating dynamic routing

2008-02-15 Thread Voyager2K

*
"fir url argument" = "first url argument"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



creating dynamic routing

2008-02-15 Thread Voyager2K

help me create dynamic routing.

A have a DB tree structure of pages like

- page1
- page1.1
- page1.2
- page2
- page2.1

and have a MyPagesController which handle request like

/MyPages/show/page1/
or
/MyPages/show/page1/page1.2/

How can i trim URL  this format:
 /page1/
or
/page1/page1.2/

One idea i have: after bootsrap.php before dispatcher
- load MyPagesModel
- look all db trees
- formate route::connect

but i think it will be too long.

May be do something for dispatcher which call
/MyPages/show/
if not found controller name like fir url argument ?

Help me plesase.

PS. Sorry my Englsih
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---