Open Source Content Management Framework

MidCOM dbobject and __exec_create

  1. MidCOM dbobject and __exec_create

    Tue June 30 2009 19:35:05 UTC
    Hi!

    Can someone explain me dbobject create_post_ops workaround in
    baseclasses/core/dbobject.php?

    if ( !$object->__exec_create()
    && $object->id == 0)
    {
    /.../
    }

    self::create_post_ops($object);


    function create_post_ops(&$object)
    {
    if (! $object->guid)
    {
    $tmp = new $object->__mgdschema_class_name__();
    if ( !$object->id
    || !$tmp->get_by_id($object->id))
    {

    I assume $tmp is some MgdSchema class instance, but how on earth $object
    can have guid set?
    __exec_create returns MgdSchema class create via $this->__object->create().
    $object will *always* have empty guid.

    Either there should be method like:

    function create_post_ops()
    {
    if (! $this->__object->guid)

    or there's something I do not understand?

    Piotras
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  2. Re: [midgard-dev] MidCOM dbobject and __exec_create

    Tue June 30 2009 19:40:11 UTC
    Hi,

    On Tue, Jun 30, 2009 at 10:24 PM, Piotr Pokora<piotrek.pokora@gmail.com> wrote:
    > I assume $tmp is some MgdSchema class instance, but how on earth $object
    > can have guid set?

    The DBA decorator class uses magic getters and setters to access
    properties of the actual MgdSchema object stored in __object.

    > Piotras

    /Henri

    --
    Henri Bergius
    Motorcycle Adventures and Free Software
    http://bergie.iki.fi/

    Skype: henribergius
    Jabber: henri.bergius@gmail.com
    Microblog: http://www.qaiku.com/home/bergie/
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  3. Re: [midgard-dev] MidCOM dbobject and __exec_create

    Thu July 02 2009 10:20:07 UTC
    Henri Bergius writes:
    > Hi,

    Hi!

    > On Tue, Jun 30, 2009 at 10:24 PM, Piotr Pokora<piotrek.pokora@gmail.com> wrote:
    >> I assume $tmp is some MgdSchema class instance, but how on earth $object
    >> can have guid set?
    >
    > The DBA decorator class uses magic getters and setters to access
    > properties of the actual MgdSchema object stored in __object.

    Ah, right. But this workaround seems to be shooting own foot.
    Setting object's guid (if it's set anyway) doesn't mean an underlying
    object reference is the same.
    Actually, there's another instance created. Both PHP and GObject one.

    It could work in 1.7 and 1.8 as those used bulk properties set with
    every I/O operation.
    Since Ragnaroek (as we focus on PHP5 only) objects' reference is always 1:1.

    Piotras
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  4. Re: [midgard-dev] MidCOM dbobject and __exec_create

    Mon July 20 2009 11:40:10 UTC
    Hi,

    On Thu, Jul 2, 2009 at 1:11 PM, Piotr Pokora<piotrek.pokora@gmail.com> wrote:
    > Since Ragnaroek (as we focus on PHP5 only) objects' reference is always 1:1.

    Well, the point is: this works fine in Ragnaroek, but doesn't in Mjolnir.

    > Piotras

    /Henri

    --
    Henri Bergius
    Motorcycle Adventures and Free Software
    http://bergie.iki.fi/

    Skype: henribergius
    Jabber: henri.bergius@gmail.com
    Microblog: http://www.qaiku.com/home/bergie/
    Sent from Helsinki, ES, Finland
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  5. Re: [midgard-dev] MidCOM dbobject and __exec_create

    Mon July 20 2009 13:50:06 UTC
    Henri Bergius writes:
    > Hi,

    Hi!

    > On Thu, Jul 2, 2009 at 1:11 PM, Piotr Pokora<piotrek.pokora@gmail.com> wrote:
    >> Since Ragnaroek (as we focus on PHP5 only) objects' reference is always 1:1.
    >
    > Well, the point is: this works fine in Ragnaroek, but doesn't in Mjolnir.

    Hmm... midgard-php extension should be the same in both.
    How can I setup environment to test this?

    Piotras
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  6. Re: [midgard-dev] MidCOM dbobject and __exec_create

    Wed July 22 2009 15:40:06 UTC
    Hi,

    On Mon, Jul 20, 2009 at 4:45 PM, Piotr Pokora<piotrek.pokora@gmail.com> wrote:
    > Hmm... midgard-php extension should be the same in both.
    > How can I setup environment to test this?

    Here's a script that reproduces this without messy MidCOM being
    involved (thanks, Alexey for finding the probable suspect):

    $topic = new midgard_topic();
    echo "GUID: {$topic->guid}<br />\n";
    $topic->extra = "test " . time();
    echo $topic->create();
    var_dump($topic);
    die("that's all, folks " . midgard_connection::get_error_string());

    So, Midgard loses track of the object when you *read* the GUID
    property before create().

    > Piotras

    /Henri

    --
    Henri Bergius
    Motorcycle Adventures and Free Software
    http://bergie.iki.fi/

    Skype: henribergius
    Jabber: henri.bergius@gmail.com
    Microblog: http://www.qaiku.com/home/bergie/
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
  7. Re: [midgard-dev] MidCOM dbobject and __exec_create

    Wed July 22 2009 16:35:06 UTC
    Henri Bergius writes:
    > Hi,

    Hi!

    > On Mon, Jul 20, 2009 at 4:45 PM, Piotr Pokora<piotrek.pokora@gmail.com> wrote:
    >> Hmm... midgard-php extension should be the same in both.
    >> How can I setup environment to test this?
    >
    > Here's a script that reproduces this without messy MidCOM being
    > involved (thanks, Alexey for finding the probable suspect):
    >
    > $topic = new midgard_topic();
    > echo "GUID: {$topic->guid}<br />\n";
    > $topic->extra = "test " . time();
    > echo $topic->create();
    > var_dump($topic);
    > die("that's all, folks " . midgard_connection::get_error_string());
    >
    > So, Midgard loses track of the object when you *read* the GUID
    > property before create().

    Object itself is not lost.
    Probably I copied two lines of code to wrong place when datatime issues
    has been fixed.

    Anyway, it's fixed.

    Piotras
    _______________________________________________
    dev mailing list
    dev@lists.midgard-project.org
    http://lists.midgard-project.org/mailman/listinfo/dev
    •  Reply
Designed by Nemein, hosted by Kafit