/** * @see Yun_Db_Adapter_Interface::lastInsertId() */ public function lastInsertId() { if (null === $this->pdo) { return false; } $re = $this->pdo->lastInsertId(); if (false === $re) { $this->setPdoError(); } return $re; }
static function insert($sql, $data = array()) { self::query($sql, $data); return self::$inst->lastInsertId(); }
/** * Retourne l'identifiant de la dernière ligne insérée * @return int L'identifiant */ public function lastInsertId() { return $this->dbh->lastInsertId(); }
`date_modified` = now(), `image` = :image '); $parentId = 0; if ($category['parent_id']) { if (!isset($categories[$category['parent_id']])) { throw new \Exception(sprintf('Parent category %d not found', $category['parent_id'])); } $categoryParent = $categories[$category['parent_id']]; if (!isset($categoryParent['dst_category_id'])) { throw new \Exception(sprintf('Parent category %d not saved yet', $category['parent_id'])); } $parentId = $categoryParent['dst_category_id']; } $sth->execute(['parent_id' => $parentId, 'sort_order' => $category['sort_order'], 'image' => str_replace('data', 'catalog', $category['image'])]); $category['dst_category_id'] = $dst->lastInsertId(); $sth = $dst->prepare(' INSERT INTO category_description SET `category_id` = :category_id, `language_id` = 2, `name` = :name, `description` = :description, `meta_title` = :meta_title, `meta_description` = :meta_description, `meta_keyword` = :meta_keyword '); $sth->execute(['category_id' => $category['dst_category_id'], 'name' => $category['name'], 'description' => $category['description'], 'meta_title' => $category['name'], 'meta_description' => $category['meta_description'], 'meta_keyword' => $category['meta_keyword']]); $level = 0; foreach (explode(',', $category['path']) as $path) { if (!isset($categories[$path])) {