Jackalope\ObjectManager::clear PHP Method

clear() public method

Removes all cached objects, planned changes etc. Mostly useful for testing purposes.
Deprecation: : this will screw up major, as the user of the api can still have references to nodes. USE refresh instead!
public clear ( )
    public function clear()
    {
        $this->objectsByPath = array('Node' => array());
        $this->objectsByUuid = array();
        $this->nodesAdd = array();
        $this->nodesRemove = array();
        $this->propertiesRemove = array();
        $this->nodesMove = array();
    }

Usage Example

Example #1
0
 /**
  * Jackalope specific hack to drop the state of the current session
  *
  * Removes all cached objects, planned changes etc without making the
  * objects aware of it. Was done as a cheap replacement for refresh
  * in testing.
  *
  * @deprecated: this will screw up major, as the user of the api can still have references to nodes. USE refresh instead!
  */
 public function clear()
 {
     trigger_error('Use Session::refresh instead, this method is extremely unsafe', E_USER_DEPRECATED);
     $this->objectManager->clear();
 }