For (almost) any db table (set) there is a corresponding dedicated PHP class extending eZPersistentObject, providing API for all the key operations on this particular dataset. If you want to be consistent, use that. For collected info, you have eZInformationCollection and eZInformationCollectionAttribute classes. You can extend them to write your own fetches or direct SQL queries - and it would be your decision which ones you use and for what purpose.
Much as I appreciate the idea behind quick and general purpose information collection, in most cases I find dedicated tables and classes encapsulated within custom extension a better choice.
I will write the code I used in hope that it will help someone:
// gets DB instance
$db = eZDB::instance();
// SQL
$sql = "
SELECT
count( ezinfocollection_attribute.id ) as count
FROM
ezinfocollection_attribute
WHERE
ezinfocollection_attribute.contentobject_attribute_id = '" . $contentObjectAttribute->attribute('id') . "'
AND ezinfocollection_attribute.contentclass_attribute_id = '" . $contentObjectAttribute->attribute('contentclassattribute_id') . "'
AND ezinfocollection_attribute.data_text LIKE '" . addslashes($email) . "'
";
// executes query
$resArray = $db->arrayQuery( $sql );
// verifies if the e-mail was found
if (intval($resArray[0]['count']) > 0) {
// found
}
// not found
Michael
You must be logged in to post messages in this topic!