Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

initialization of the static variable Ardent::$rules #292

Open
Cyrille37 opened this issue Feb 6, 2016 · 1 comment
Open

initialization of the static variable Ardent::$rules #292

Cyrille37 opened this issue Feb 6, 2016 · 1 comment

Comments

@Cyrille37
Copy link

Hi,
not a bug but a needed feature.

I would like to define some Ardent::$rules with concatenation of constants. But Php5.6 does not want concatenation in declaration of static variables.

class Abc extends Ardent
{
    const NAME_LENGTH_MAX = 40 ;

    public static $rules = array (
        // Here, wants to replace 40 by Abc::NAME_LENGTH_MAX
        'name' => ['required','between:3,40', 'regex:/^[[:word:] \-]+$/u'],
        // Syntax error :
        'name' => ['required','between:3,'.Abc::NAME_LENGTH_MAX, 'regex:/^[[:word:] \-]+$/u'],
    );

Is there another way,place where we can initialize Ardent::$rules values ?

Cheers

@igorsantos07
Copy link
Member

This could be bad memory block in my brain as I'm not accessing the
source now, but have you tried adding a rules() method?

If that does not work, that's probably how it would be implemented hmmm,
with the method returning the static var by default and replacing all
variable calls.
On 6 Feb 2016 09:05, "Cyrille Giquello" notifications@github.com wrote:

Hi,
not a bug but a needed feature

I would like to define some Ardent::$rules with concatenation of
constants But Php56 does not want concatenation in declaration of static
variables

class Abc extends Ardent{ const NAME_LENGTH_MAX = 40 ; public static $rules = array ( // Here, wants to replace 40 by Abc::NAME_LENGTH_MAX 'name' => ['required','between:3,40', 'regex:/^[[:word:] -]+$/u'], // Syntax error : 'name' => ['required','between:3,'Abc::NAME_LENGTH_MAX, 'regex:/^[[:word:] -]+$/u'], );

Is there another way,place where we can initialize Ardent::$rules values
?

Cheers


Reply to this email directly or view it on GitHub
#292.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants