Welcome Guest, Not a member yet? Register   Sign In
DMZ 1.7.1 (DataMapper OverZealous Edition)

[eluser]7amza[/eluser]
WanWizard i wrote that one of the DMZ features is that it didn't one table for each relationship?
so why the relationship between category and portal works fine without a table just foreign key .
an other thing Page and Portal have one-to-many relationship
every page have one Portal but every Portal have many pages .

[eluser]WanWizard[/eluser]
If you have a table with a foreign key, it is always a one-to-many relationship.
And you define a many-to-many relationship, your Portal defines a $has_many to Page.

[eluser]James McMurray[/eluser]
This might be more suited to a topic about form validation in general, but as I'm using DMZ and couldn't find it in the base documentation for form validation I'm hoping DMZ has something I can do. In any case, on tot eh question. Smile

I'm using a form to allow the user to input html, which I'll then store in my database. I need to run html_entities() on the data before inserting it, and html_entity_decode() when I pull it out. Is there a way to have this automated via a validation rule using DMZ?

Thanks for all the hard work on DMZ, it's made a massive difference on my development time and is greatly appreciated.

[eluser]7amza[/eluser]
i wrote it wrong i corrected the code but still the problem exist

[eluser]WanWizard[/eluser]
@james McMurray,

Yes, that is perfectly possible, check the session of validation rules in the DMZ docs.

[eluser]James McMurray[/eluser]
Is there a page other than this one? I see ways to preprocess data as part of validation, but no way to postprocess it after retrieval from the DB.

To follow the example given there, it would be like calling encrypt as part of the validation and save process, but also calling a decrypt function when the object is loaded.

[eluser]WanWizard[/eluser]
You can define 'rules' (are applied before writing), and 'get_rules' (are applied after reading):

Code:
var $validation = array(
    'params' => array(
        'rules' => array('serialize_if_array'),
        'get_rules' => array('unserialize')
    )
);

// Validation prepping function to serialize the template parms field
function _serialize_if_array($field) // optional second parameter is not used
{
    // check if the field is an array
    if ( is_array($this->{$field}) )
    {
        // serialize the array
        $this->{$field} = serialize($this->{$field});
    }
}

[eluser]J Maxwell[/eluser]
Has anybody else seen any of the following errors when using DataMapper DMZ with CodeIgniter 2.0?

Fatal error: Uncaught exception 'Exception' with message 'Unable to call the method "__constrict" on the class post' in C:\wamp\www\Falcon\application\libraries\datamapper.php:1248

Reading the DataMapper DMZ site it seems like, whilst not officially supported, DMZ might work with 2.0?

[eluser]James McMurray[/eluser]
[quote author="WanWizard" date="1282265475"]You can define 'rules' (are applied before writing), and 'get_rules' (are applied after reading):[/quote]

Thanks a lot! They weren't mentioned on the validation page, but I found them here.

[eluser]James McMurray[/eluser]
[quote author="J Maxwell" date="1282266119"]Has anybody else seen any of the following errors when using DataMapper DMZ with CodeIgniter 2.0?

Fatal error: Uncaught exception 'Exception' with message 'Unable to call the method "__constrict" on the class post' in C:\wamp\www\Falcon\application\libraries\datamapper.php:1248

Reading the DataMapper DMZ site it seems like, whilst not officially supported, DMZ might work with 2.0?[/quote]

Is the highlighted word supposed to be "__construct"?




Theme © iAndrew 2016 - Forum software by © MyBB