本文整理匯總了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();
}