D
Deleted member 745
Guest
How do I go about getting this one for XF 2.x when I purchased the original (with Branding Removal) when XF 1.0 didn't have the Resources addon?
The resource addon has nothing to do with anything.How do I go about getting this one for XF 2.x when I purchased the original (with Branding Removal) when XF 1.0 didn't have the Resources addon?
The resource addon has nothing to do with anything.
XF2 version will not be free with the XF1 version.
I may be able to help with this, I've written some advanced finder expressions (example: https://xenforo.com/community/threads/order-by-phrase.139717/#post-1205984) and I've also some experience using the Searcher system (separate from the search index, mind) in order to create advanced filtering options.A couple of features you may notice are missing from from this new version... As usual, with every rewrite, I tend to remove features that got added in over time through feature creep.
Right now, XenForo 2's built in finder system doesn't support `TO_MANY` relations. As such, the `GROUP BY` MySQL function isn't available. I know I can write my own queries, but the XF2 finder system is just way too convenient not to use... so I'll be waiting for the `TO_MANY` relation before this feature comes back.
- Article category filtering
$finder->with('ArticleCategories|' . $categoryId);
protected function applySpecialCriteriaValue(Finder $finder, $key, $value, $column, $format, $relation)
{
if ($key == 'license_fields')
{
$exactMatchFields = !empty($value['exact']) ? $value['exact'] : [];
$customFields = array_merge($value, $exactMatchFields);
unset($customFields['exact']);
$conditions = [];
foreach ($customFields AS $fieldId => $value)
{
if ($value === '' || (is_array($value) && !$value))
{
continue;
}
$finder->with('LicenseFields|' . $fieldId);
$isExact = !empty($exactMatchFields[$fieldId]);
foreach ((array)$value AS $possible)
{
$columnName = 'LicenseFields|' . $fieldId . '.field_value';
if ($isExact)
{
$conditions[] = [$columnName, '=', $possible];
}
else
{
$conditions[] = [$columnName, 'LIKE', $finder->escapeLike($possible, '%?%')];
}
}
}
if ($conditions)
{
$finder->where($conditions);
}
return true;
}
return false;
}
->with('CatLink')->where('CatLink.category_id', '!=', ['2','6'])
Exception: Joins only support TO_ONE relationships currently in src/XF/Mvc/Entity/Finder.php at line 651
Is a CatLink just a bridge between articles and categories (like a relation map), or does it actually contain any data?Specifically, I would be looking to do:
Code:->with('CatLink')->where('CatLink.category_id', '!=', ['2','6'])
A group by is important for this, because when paginating, it can pick up a catlink an additional time, since they are not grouped.
I see, and how would you have written this if you were using raw SQL?Just a bridge. Remember, that an article can be a member of multiple categories.
SELECT articles.*
FROM articles
LEFT JOIN catlinks ON (catlinks.thread_id = articles.thread_id)
WHERE
catlinks.category_id NOT IN (" . $this->_getDb()->quote($filterOut) . ")
GROUP BY articles.thread_id
So I tried, I really did, but I ended up cheating:The way I wrote it in XF1:
Code:SELECT articles.* FROM articles LEFT JOIN catlinks ON (catlinks.thread_id = articles.thread_id) WHERE catlinks.category_id NOT IN (" . $this->_getDb()->quote($filterOut) . ") GROUP BY articles.thread_id
I dont even need TO_MANY... I just need a group by.
$finder = $this->finder('EWR\XenPorta:Article');
$map = $finder->getHydrationMap();
$results = $this->app()->db()->query("
SELECT articles.*
FROM articles
LEFT JOIN catlinks ON (catlinks.thread_id = articles.thread_id)
WHERE catlinks.category_id NOT IN (" . $this->app->db()->quote($filterOut) . ")
GROUP BY articles.field_id
");
while ($row = $results->fetchAliasGrouped())
{
$entity = $this->em()->hydrateFromGrouped($row, $map);
$id = $entity->getIdentifier();
if ($id !== null)
{
$output[$id] = $entity;
}
else
{
$output[] = $entity;
}
}
$articles = $this->em()->getBasicCollection($output);
Well yes, as you can see there are multiple references to "entity" in the codeSeems like a lot of work for something which should be as simple as->group('thread_id')
...
With the above code, could I still use the entity system?
As long as it's the same website.
Branding removals are non-transferable.Nope its not the same website as my old site no longer exists, I let it expire can I transfer my Branding Removal to my new website?
There is no difference between an upgrade and a fresh install. They are both exactly the same. You can however use the importer after the fact, to import the tables from the old install to the new version.What's upgraded when you upgrade?
We used XP1 as a portal but I don't think there's really much that would need to be carried over with an upgrade. Our articles were all just pulled from a forum and I can't think of anything else.
Wondering if a fresh install makes sense or does the upgrade deal with any old tables etc that aren't needed?
We use essential cookies to make this site work, and optional cookies to enhance your experience.