Search

Unlike previous versions of symphony in which it was possible to use the $result-> getAttribute('id') function to get the id of the last entry created, from version 2.5 isn't possible use this function. Is there an alternative?

Do you have any more context?

I need it for my chained events of an ecommerce, where the products of an order should reference the same order only if the order creation is successful. In older version it was possible using this code:

        include(TOOLKIT . '/events/event.section.php');

        if($result->getAttribute('result') == "success") {

        $nump = $_POST['nump'];

        for ($i = 0; $i < $nump; ++$i) {

            $_POST['products']['fields'][$i]['orderid'] = $result->getAttribute('id');

        }

but now both...
$result->getAttribute('result') and $result->getAttribute('id')
never work.

Ah right, that's been deprecated for a while. The new method is to use the execute method. This will return an XMLElement for you. Seehttps://github.com/symphonycms/symphony-2/blob/master/symphony/lib/toolkit/events/class.event.section.php

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details