Jackalope\ObjectManager::getPropertyByPath PHP Method

getPropertyByPath() public method

Uses the factory to instantiate a Property. Currently Jackalope just loads the containing node and then returns the requested property of the node instance.
public getPropertyByPath ( string $absPath ) : PHPCR\PropertyInterface
$absPath string The absolute path of the property to create.
return PHPCR\PropertyInterface
    public function getPropertyByPath($absPath)
    {
        list($name, $nodep) = $this->getNodePath($absPath);
        // OPTIMIZE: should use transport->getProperty - when we implement this, we must make sure only one instance of each property ever exists. and do the moved/deleted checks that are done in node
        $n = $this->getNodeByPath($nodep);
        try {
            return $n->getProperty($name);
            //throws PathNotFoundException if there is no such property
        } catch (PathNotFoundException $e) {
            throw new ItemNotFoundException($e->getMessage(), $e->getCode(), $e);
        }
    }

Usage Example

示例#1
0
 /**
  * {@inheritDoc}
  *
  * @api
  */
 public function getProperty($absPath)
 {
     try {
         return $this->objectManager->getPropertyByPath($absPath);
     } catch (ItemNotFoundException $e) {
         throw new PathNotFoundException($e->getMessage(), $e->getCode(), $e);
     }
 }