本文整理汇总了PHP中BaseObject::hasChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseObject::hasChildren方法的具体用法?PHP BaseObject::hasChildren怎么用?PHP BaseObject::hasChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseObject
的用法示例。
在下文中一共展示了BaseObject::hasChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: objectToJson
/**
* Get node properties from propel object.
*
* @param mixed|BaseObject $instance
* @param Curry_Tree $tree
* @param int $depth
* @return array
*/
public function objectToJson($instance, Curry_Tree $tree, $depth = 0)
{
$p = array('title' => (string) $instance, 'key' => (string) $instance->getPrimaryKey());
if ($instance->hasChildren()) {
$p['children'] = array();
if ($this->lazy) {
$p['isLazy'] = true;
}
}
return $p;
}
示例2: preDelete
/**
* Runs necessary queries before node is deleted.
*
* @param BaseObject $node
*/
public function preDelete(BaseObject $node)
{
$peer_name = get_class($node->getPeer());
$this->addPreDeleteStackEntries(self::shiftRLRange($peer_name, $node->getLeftValue(), $node->getRightValue(), -1, $node->getScopeIdValue()));
$this->addPreDeleteStackEntries(self::shiftRLValues($peer_name, $node->getRightValue() + 1, -2, $node->getScopeIdValue()));
// Take care of adjacency parameters
if ($node->hasChildren()) {
$peer_name = get_class($node->getPeer());
$node_class = get_class($node);
$query = sprintf('UPDATE %s SET %s = %s WHERE %s = %s', constant("{$peer_name}::TABLE_NAME"), self::getColumnConstant($node_class, 'parent', true), $node->getParentIdValue(), self::getColumnConstant($node_class, 'parent'), $node->getPrimaryKey());
$con = Propel::getConnection();
$statement = $con->createStatement();
$statement->execute($query);
}
$this->processPreDeleteStack();
}