SqliImport, search if attribute value already exists

Author Message

Jérémie Caulier

Tuesday 03 May 2011 12:56:03 am

I have a content type that looks like this:
myContentType
{
unique_id: integer
title: string
...
}

I retrieve data from an external data source and want to aggregate them automatically in eZ Publish content tree.

But before the import, I want to check if an other object related to "myContenType" not exists with the same unique_id value ...

What is the best way to proceed ?

Jérôme Vieilledent

Thursday 05 May 2011 6:16:45 am

Hi Jérémie

Actually, it's already implemented, native and automatic :).

If you use RemoteID, SQLIContent::create() will automatically check if a content already exists with this RemoteID. If this is the case, it will be returned. Then, when you'll publish it, the publisher will go through all the attributes and check if there has been a modification. If this is the case, a new version is created, if not the content is not modified.

You can check the doc in the "Simplified content API" part : http://svn.projects.ez.no/sqliimport/trunk/doc/README.txt

Jérémie Caulier

Saturday 07 May 2011 4:12:35 am

Thnx, it's a really nice extension !

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 00:53:22
Script start
Timing: Jan 30 2025 00:53:22
Module start 'layout'
Timing: Jan 30 2025 00:53:22
Module start 'content'
Timing: Jan 30 2025 00:53:22
Module end 'content'
Timing: Jan 30 2025 00:53:22
Script end

Main resources:

Total runtime0.0412 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 588.2813151.2266
Module start 'layout' 0.00710.0032 739.507836.6875
Module start 'content' 0.01030.0292 776.195390.3906
Module end 'content' 0.03960.0015 866.585929.9766
Script end 0.0411  896.5625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00286.7046140.0002
Check MTime0.00112.7275140.0001
Mysql Total
Database connection0.00133.119710.0013
Mysqli_queries0.00296.943930.0010
Looping result0.00000.048710.0000
Template Total0.00102.610.0010
Template load0.00082.045610.0008
Template processing0.00020.493010.0002
Override
Cache load0.00061.392710.0006
General
dbfile0.018244.230480.0023
String conversion0.00000.023840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs