- ⌂ collection
- Methods
collection::clear_objects()
Remove all objects from the collection.
If the collection represents an object field, and the object is subsequently stored, saved or approved, the objects will be eliminated from the field. If the object field contains embedded object, the objects themselves will also be removed. If the object field references the objects, then the objects will only be removed from the field, and not removed from the repository.
To remove a specific set of objects, use remove_objects().
Prototype
void clear_objects()
Example
$contacts = $repo->get("FROM Contact WHERE !ISNULL(Relatives)");
foreach($contacts as $contact) {
// remove all contact references from Relatives field
$contact->Relatives->clear_objects();
$contact->approve();
}