本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeData::hasProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeData::hasProperty方法的具体用法?PHP NodeData::hasProperty怎么用?PHP NodeData::hasProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeData
的用法示例。
在下文中一共展示了NodeData::hasProperty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: propertyFunctionsUseAContentObjectIfOneHasBeenDefined
/**
* @test
*/
public function propertyFunctionsUseAContentObjectIfOneHasBeenDefined()
{
$this->inject($this->nodeData, 'persistenceManager', $this->createMock('TYPO3\\Flow\\Persistence\\PersistenceManagerInterface'));
$className = uniqid('Test');
eval('
class ' . $className . ' {
public $title = "My Title";
public $body = "My Body";
}
');
$contentObject = new $className();
$this->nodeData->setContentObject($contentObject);
$this->assertTrue($this->nodeData->hasProperty('title'));
$this->assertFalse($this->nodeData->hasProperty('iltfh'));
$this->assertEquals('My Body', $this->nodeData->getProperty('body'));
$this->assertEquals('My Title', $this->nodeData->getProperty('title'));
$this->assertEquals(array('title' => 'My Title', 'body' => 'My Body'), $this->nodeData->getProperties());
$actualPropertyNames = $this->nodeData->getPropertyNames();
sort($actualPropertyNames);
$this->assertEquals(array('body', 'title'), $actualPropertyNames);
$this->nodeData->setProperty('title', 'My Other Title');
$this->nodeData->setProperty('body', 'My Other Body');
$this->assertEquals('My Other Body', $this->nodeData->getProperty('body'));
$this->assertEquals('My Other Title', $this->nodeData->getProperty('title'));
}
示例2: matches
/**
* Returns TRUE if the given node has the property and the value is not empty.
*
* @param NodeData $node
* @return boolean
*/
public function matches(NodeData $node)
{
if ($node->hasProperty($this->propertyName)) {
$propertyValue = $node->getProperty($this->propertyName);
return !empty($propertyValue);
}
return false;
}
示例3: matches
/**
* Returns TRUE if the given node has the property and the value is not empty.
*
* @param \TYPO3\TYPO3CR\Domain\Model\NodeData $node
* @return boolean
*/
public function matches(\TYPO3\TYPO3CR\Domain\Model\NodeData $node)
{
if ($node->hasProperty($this->propertyName)) {
$propertyValue = $node->getProperty($this->propertyName);
return !empty($propertyValue);
}
return FALSE;
}
示例4: extractComments
/**
* Extract comments and deserialize them
*
* @param NodeInterface|NodeData $nodeOrNodeData
* @return array
*/
protected function extractComments($nodeOrNodeData)
{
if ($nodeOrNodeData->hasProperty('comments')) {
$comments = $nodeOrNodeData->getProperty('comments');
if (is_string($comments) && strlen($comments) > 0) {
return json_decode($comments, TRUE);
}
}
return array();
}
示例5: hasProperty
/**
* If this node has a property with the given name.
*
* If the node has a content object attached, the property will be checked
* there.
*
* @param string $propertyName
* @return boolean
* @api
*/
public function hasProperty($propertyName)
{
return $this->nodeData->hasProperty($propertyName);
}
示例6: isTransformable
/**
* Returns TRUE if the given node has the property to work on.
*
* @param NodeData $node
* @return boolean
*/
public function isTransformable(NodeData $node)
{
return $node->hasProperty($this->propertyName);
}
示例7: isTransformable
/**
* Returns TRUE if the given node has the property to work on.
*
* @param \TYPO3\TYPO3CR\Domain\Model\NodeData $node
* @return boolean
*/
public function isTransformable(\TYPO3\TYPO3CR\Domain\Model\NodeData $node)
{
return $node->hasProperty($this->propertyName);
}