Re: cake 1.2 forms: date fields left empty => null in database?

2008-12-18 Thread Sebastian Göttschkes

Hi,

thanks for your reply. The data field was set to null before. If I
update a dataset and assigning the null value to a the birthday field
(SET birthday=null) it works fine. So I added the following code to my
controller:
if(empty($this->data['Employee']['birthday']))
$this->data['Employee']['birthday'] = null;
This works fine, but I'm not sure if this is the proper way to do it?

Regards,
Sebastian

On 16 Dez., 15:13, Alexandru Ciobanu  wrote:
> Sebastian Göttschkes wrote:
> > Hi,
>
> > i got the following problem using cakePHP 1.2 RC3:
>
> > My Model 'Employee' has a attribute called 'birthday' (datatype:
> > DATE). In the add-view, I have the following code:
> > input('birthday',array('type'=>'text'));?>
> > If i left this field blank when adding an employee, this employee has
> > the birthday '-00-00' saved in the database. I would rather like
> > the birthday having the null-value, because -00-00 is no valid
> > birthday.
>
> Set the date field to NULL
> |ALTER TABLE `employees` CHANGE `birthday` `birthday` DATE NULL;
>
> IIRC
>
> HTH
> |
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



cake 1.2 forms: date fields left empty => null in database?

2008-12-16 Thread Sebastian Göttschkes

Hi,

i got the following problem using cakePHP 1.2 RC3:

My Model 'Employee' has a attribute called 'birthday' (datatype:
DATE). In the add-view, I have the following code:
input('birthday',array('type'=>'text'));?>
If i left this field blank when adding an employee, this employee has
the birthday '-00-00' saved in the database. I would rather like
the birthday having the null-value, because -00-00 is no valid
birthday.

Additionally, if I add a valid birthday, it is saved correctly. When
editing the employee, I would like to get the birthday viewed in the
format dd.mm.. How can I tell cake to view the birthday like this?

I hope you guys can help me.

Thanks in advance,
Regards,
Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Setting validation error in a controller?

2008-12-08 Thread Sebastian Göttschkes

Hi there,

I have a problem using validation in cakePHP.

I want to add an error dynamic in the controller to be viewed in the
view right there where the normal validation errors are shown.

I found the $this->ModelName->invalidFields(); function, which returns
all errors, but I found no function to add new errors.

Is there an easy way to do this or do I have to make "ugly" code?

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



Re: Validation date: which key?

2008-12-02 Thread Sebastian Göttschkes

Hi Guenther,

this works quiet well, thank you. I'll add this to the docs with an
example to provide an answer to anyone who is facing the same issue.

Regards,
Sebastian

On 2 Dez., 15:17, Günther Theilen <[EMAIL PROTECTED]> wrote:
> Hi Sebastian,
>
> I'm not 100% sure but this should work:
>
> 'date' => array (
>    array(
>      'rule' => array('date', array('dmy'))
> etc.
>
> Regards
> Guenther
>
> Sebastian Göttschkes schrieb:
>
> > Hi Deepesh,
>
> > thanks for your reply.
>
> > Sure, I could make a custom validation rule, but as it is written in
> > the doc, there is a way to use different time formats with the date
> > validation. Why dublicate it? The only thing I need is the key I have
> > to use in the array.
>
> > Regards,
> > Sebastian
>
> > On 2 Dez., 12:35, deepesh <[EMAIL PROTECTED]> wrote:
> >> Hi Sebastian ,
> >>                         Why dont you try custom validation method
>
> >>http://book.cakephp.org/view/150/Custom-Validation-Rules
>
> >> you can easily make a function there and a small php code will be
> >> required there to chk right format.
>
> >> Best Regards,
> >> Deepesh Gairola
>
> >> Sebastian Göttschkes wrote:
> >>> Hi,
> >>> I want to use the "dmy"-value for the date validation. But I cannot
> >>> find which key I must use to pass the value.
> >>> Actually, my validation looks like this:
> >>> 'date' => array (
> >>>                    array(
> >>>                            'rule' => 'date',
> >>>                            'message' => 'Das Datum muss in der Form 
> >>> TT.MM. angegeben
> >>> sein',
> >>>                            'required' => true
> >>>                    )
> >>>            )
> >>> Thanks in advance.
> >>> Regards,
> >>> Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validation date: which key?

2008-12-02 Thread Sebastian Göttschkes

Hi Deepesh,

thanks for your reply.

Sure, I could make a custom validation rule, but as it is written in
the doc, there is a way to use different time formats with the date
validation. Why dublicate it? The only thing I need is the key I have
to use in the array.

Regards,
Sebastian

On 2 Dez., 12:35, deepesh <[EMAIL PROTECTED]> wrote:
> Hi Sebastian ,
>                         Why dont you try custom validation method
>
> http://book.cakephp.org/view/150/Custom-Validation-Rules
>
> you can easily make a function there and a small php code will be
> required there to chk right format.
>
> Best Regards,
> Deepesh Gairola
>
> Sebastian Göttschkes wrote:
> > Hi,
>
> > I want to use the "dmy"-value for the date validation. But I cannot
> > find which key I must use to pass the value.
>
> > Actually, my validation looks like this:
>
> > 'date' => array (
> >                    array(
> >                            'rule' => 'date',
> >                            'message' => 'Das Datum muss in der Form 
> > TT.MM. angegeben
> > sein',
> >                            'required' => true
> >                    )
> >            )
>
> > Thanks in advance.
>
> > Regards,
> > Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Validation date: which key?

2008-12-02 Thread Sebastian Göttschkes

Hi,

I want to use the "dmy"-value for the date validation. But I cannot
find which key I must use to pass the value.

Actually, my validation looks like this:

'date' => array (
array(
'rule' => 'date',
'message' => 'Das Datum muss in der Form 
TT.MM. angegeben
sein',
'required' => true
)
)

Thanks in advance.

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



Re: belongsTo via form

2008-11-29 Thread Sebastian Göttschkes

Hi,

I now found a article in the bakery explaining what to do to save 2
models.

For anyone facing the same problem, here you go:
http://book.cakephp.org/view/75/Saving-Your-Data

Sebastian

On 28 Nov., 22:16, Sebastian Göttschkes
<[EMAIL PROTECTED]> wrote:
> Thank you for your reply.
>
> I can't get it working. Neither the validation nor the adding of a
> dataset is working.
>
> On 26 Nov., 23:35, thatsgreat2345 <[EMAIL PROTECTED]> wrote:
>
> > instead of company do Company.name or whatever field you have called
> > to save the name.
>
> > On Nov 26, 2:18 pm, Sebastian Göttschkes
>
> > <[EMAIL PROTECTED]> wrote:
> > > Hi there,
>
> > > I got a problem I cannot solve using the docs or google.
>
> > > I have a Model User, which contains all users. Every User belongs to a
> > > Company, so I added a foreign key company_id to the users table and
> > > added a table companies. Everything is working well to this point.
>
> > > Know I want to add the following workflow:
> > > When a user is created, he can add the company he belongs to by just
> > > entering the name of this company to a input-field (type: text). So I
> > > added the following to the view:
> > > input('company',array('type'=>'text')); ?>
> > > But how do I proceed within the add action? Espacially when I want to
> > > use the validation.
>
> > > I'm not sure if I have to create a new company-object and validate
> > > everything myself or if I can use some build-in functionallity.
>
> > > Thanks in advance.
>
> > > Regards,
> > > Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: belongsTo via form

2008-11-28 Thread Sebastian Göttschkes

Thank you for your reply.

I can't get it working. Neither the validation nor the adding of a
dataset is working.

On 26 Nov., 23:35, thatsgreat2345 <[EMAIL PROTECTED]> wrote:
> instead of company do Company.name or whatever field you have called
> to save the name.
>
> On Nov 26, 2:18 pm, Sebastian Göttschkes
>
> <[EMAIL PROTECTED]> wrote:
> > Hi there,
>
> > I got a problem I cannot solve using the docs or google.
>
> > I have a Model User, which contains all users. Every User belongs to a
> > Company, so I added a foreign key company_id to the users table and
> > added a table companies. Everything is working well to this point.
>
> > Know I want to add the following workflow:
> > When a user is created, he can add the company he belongs to by just
> > entering the name of this company to a input-field (type: text). So I
> > added the following to the view:
> > input('company',array('type'=>'text')); ?>
> > But how do I proceed within the add action? Espacially when I want to
> > use the validation.
>
> > I'm not sure if I have to create a new company-object and validate
> > everything myself or if I can use some build-in functionallity.
>
> > Thanks in advance.
>
> > Regards,
> > Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



belongsTo via form

2008-11-26 Thread Sebastian Göttschkes

Hi there,

I got a problem I cannot solve using the docs or google.

I have a Model User, which contains all users. Every User belongs to a
Company, so I added a foreign key company_id to the users table and
added a table companies. Everything is working well to this point.

Know I want to add the following workflow:
When a user is created, he can add the company he belongs to by just
entering the name of this company to a input-field (type: text). So I
added the following to the view:
input('company',array('type'=>'text')); ?>
But how do I proceed within the add action? Espacially when I want to
use the validation.

I'm not sure if I have to create a new company-object and validate
everything myself or if I can use some build-in functionallity.

Thanks in advance.

Regards,
Sebastian

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



Re: Authentificate against LDAP?

2008-11-06 Thread Sebastian Göttschkes

Thanks for your help. I'll have a look at the bakery.

There is no way not using AD as LDAP, so I need to find a way to get
AD working.

On 4 Nov., 13:11, hydra12 <[EMAIL PROTECTED]> wrote:
> There are some articles in the bakery about using ldap as a model.  I
> haven't used them, so I couldn't say how well they work.  I do know
> that ActiveDirectory is microsoft's version of ldap and doesn't always
> work quite the way you think it should.  Personally, I use adLdap
> (http://adldap.sourceforge.net/).  I drop it in the vendors folder,
> then create an instance of adldap in my users controller and do all my
> authentication there.  I've had good luck with it so far, but it's not
> 'cakey', so it might not be what you are looking for.
>
> I hope that helps.
> hydra12
>
> On Nov 4, 4:11 am, Sebastian Göttschkes <[EMAIL PROTECTED]
>
> e.de> wrote:
> > Hi,
>
> > I started using cakePHP not long ago and it's really nice. It works
> > great for me and my time and effort building web apps has decreased.
> > Thank you for this!
>
> > Right now I got this problem: I need to authentificate not against a
> > database but against a LDAP (Active Directory).
>
> > In the database I got a table employees, containing all employees with
> > their login name (not the password) and other data. When a employee is
> > sending his login name and password, I want to authentificate him
> > against the LDAP. If the password is correct AND his dataset is found
> > in the table (using his login name), the login was correct and he can
> > use the application.
>
> > Is their an easy way to handle this task with cakePHP? I have searched
> > the docs but only found the "normal" authentification against a
> > database. This is not possible as there is no way for me to read the
> > password from the LDAP into the database. I read something about
> > models representing LDAP entries, but didn't found any information on
> > that.
>
> > I hope you guys can help me!
>
> > Regards,
> > Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Authentificate against LDAP?

2008-11-04 Thread Sebastian Göttschkes

Hi,

I started using cakePHP not long ago and it's really nice. It works
great for me and my time and effort building web apps has decreased.
Thank you for this!

Right now I got this problem: I need to authentificate not against a
database but against a LDAP (Active Directory).

In the database I got a table employees, containing all employees with
their login name (not the password) and other data. When a employee is
sending his login name and password, I want to authentificate him
against the LDAP. If the password is correct AND his dataset is found
in the table (using his login name), the login was correct and he can
use the application.

Is their an easy way to handle this task with cakePHP? I have searched
the docs but only found the "normal" authentification against a
database. This is not possible as there is no way for me to read the
password from the LDAP into the database. I read something about
models representing LDAP entries, but didn't found any information on
that.

I hope you guys can help me!

Regards,
Sebastian

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