On Mar 16, 2:42 pm, AD7six <[email protected]> wrote:
> On Mar 16, 8:12 pm,yaman666<[email protected]> wrote:
>
> Show what you've got and why, and someone will probably point you in
> the right direction. probably: do it with a behavior and var $actsAs =
> array('Foo'); in your app model.

I have not looked into $actsAs, will research it as soon as I can.

Basically models have a custom xml component to store highly
customizable data without continuously changing table structure. For
example a model table has only "id", "xml" and "created_at" fields.
AppModel has a DOMDocument property. On model load it would load xml
into dom document. On model save it would save dom document into xml
field. And any customizable data can be accessed via xpath through the
dom document.

class AppModel extends Model {
    public $dom;

    public function __construct($id = false, $table = null, $ds =
null) {
        parent::__construct($id, $table, $ds);
        $this->dom = new DOMDocument;
        if (isset($this->data[get_class($this)]["xml"])) {
            $this->dom->LoadXML($this->data[get_class($this)]["xml"]);
        }
    }

    public function beforeSave() {
        if (isset($this->data[get_class($this)]["xml"])) {
            $this->data[get_class($this)]["xml"] = $this->dom->SaveXML
();
        }
        return true;
    }
}

If you can offer another way to do it I'd be really interested to
know.

Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to