public function testParseSubItemFiltersInvalidNonFuzzy()
 {
     $caught = false;
     try {
         EarthIT_Storage_ItemFilters::parseMulti(array('user-organization-attachments.user.username' => 'not:in:Frodo Baggins,Jim Henson'), $orgRc, $this->registry->schema, true);
     } catch (Exception $e) {
         $caught = true;
     }
     $this->assertTrue($caught, "non-fuzzy parsing of " . "'user-organization-attachments.user.username' filter should have thrown an exception");
 }
 public function __construct(EarthIT_Schema_ResourceClass $rc, EarthIT_Storage_ItemFilter $filter = null, EarthIT_Storage_Comparator $comparator = null, $skip = 0, $limit = null)
 {
     if ($filter === null) {
         $filter = EarthIT_Storage_ItemFilters::emptyFilter();
     }
     if ($comparator === null) {
         $comparator = new EarthIT_Storage_FieldwiseComparator(array());
     }
     $this->resourceClass = $rc;
     $this->filter = $filter;
     $this->comparator = $comparator;
     $this->skip = $skip;
     $this->limit = $limit;
 }
 public function testUpdatePks()
 {
     $orgRc = $this->registry->schema->getResourceClass('organization');
     $id0 = $this->newEntityId();
     $id1 = $this->newEntityId();
     $newOrgs = self::keyById($this->storage->saveItems(array(array('ID' => $id0, 'name' => 'Test Org ' . $id0)), $orgRc, array(EarthIT_Storage_ItemSaver::RETURN_SAVED => true)));
     $updated = self::keyById($this->storage->updateItems(array('ID' => $id1), $orgRc, EarthIT_Storage_ItemFilters::byId($id0, $orgRc), array(EarthIT_Storage_ItemUpdater::RETURN_UPDATED => true)), $orgRc);
     $this->assertEquals(array($id1 => array('ID' => $id1, 'name' => 'Test Org ' . $id0, 'office location' => null)), $updated);
 }
Example #4
0
 public static function getItemsById(array $ids, EarthIT_Schema_ResourceClass $rc, EarthIT_Storage_ItemSearcher $storage, array $options = array())
 {
     $filter = EarthIT_Storage_ItemFilters::byId($ids, $rc);
     $search = new EarthIT_Storage_Search($rc, $filter);
     return $storage->searchItems($search, $options);
 }