Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

EZP-26273: Use QueryType for the top menu #39

Merged
merged 1 commit into from
Sep 29, 2016

Conversation

clash82
Copy link
Contributor

@clash82 clash82 commented Sep 6, 2016

@clash82 clash82 force-pushed the query-controller-for-menu branch 3 times, most recently from ab9b2a3 to 92940b0 Compare September 8, 2016 12:21
@clash82 clash82 changed the title Change menuCriteria into menuQueryType EZP-26273: Use QueryType for the top menu Sep 8, 2016
@clash82
Copy link
Contributor Author

clash82 commented Sep 8, 2016

@kamilmusial
Copy link

+1

1 similar comment
@damianz5
Copy link
Contributor

damianz5 commented Sep 8, 2016

+1

@clash82 clash82 closed this Sep 8, 2016
@clash82 clash82 reopened this Sep 8, 2016
- '@ezpublish.api.service.location'
- '@ezpublish.config.resolver'
- '@app.criteria.menu'
- '@ezpublish.query_type.registry'
Copy link
Member

@bdunogier bdunogier Sep 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could simplify dependencies here by passing the QueryType directly: - '@app.query_type.menu'. Then you don't need to use the registry anymore.

Copy link
Contributor Author

@clash82 clash82 Sep 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm not sure it's really relevant to demonstrate the complicated way, and comment out with the simplest one. I'd instead inject the query type, and explain that the registry could be used instead.

Both work, of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed. If it's too complicated we should be simplify it :)

@clash82 clash82 force-pushed the query-controller-for-menu branch 7 times, most recently from 11e99ad to 7419c94 Compare September 14, 2016 12:57
@clash82
Copy link
Contributor Author

clash82 commented Sep 14, 2016

@bdunogier can I ask you for a final review?

@clash82
Copy link
Contributor Author

clash82 commented Sep 21, 2016

big boss, can you have a look? ;) @bdunogier

Copy link
Member

@bdunogier bdunogier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple minor remarks. Feel free to adopt them or not, it's good in both cases, as far as i'm concerned.

/**
* @param string[] $value
*/
public function setLanguages($value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the parameter is always an array, you should typehint it as such.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I forgot about it.

new Query\Criterion\Visibility(Query\Criterion\Visibility::VISIBLE),
new Query\Criterion\Location\Depth(
Query\Criterion\Operator::BETWEEN,
[
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to wrap this array's content on multiple lines, it will be as readable on one line. Importing eZ\Publish\API\Repository\Values\Content\Query\Criterion in the current namespace would also allow you to shorten this down:

$criteria = new Criterion\LogicalAnd([
  new Criterion\Visibility(Criterion\Visibility::VISIBLE),
  new Criterion\Location\Depth(Criterion\Operator::BETWEEN, [1, 2]),
  new Criterion\Subtree('/1/2/'),
  new Criterion\LanguageCode($this->languages),

Also, could the depth be handled as new Criterion\Location\Depth(Criterion\Operator::LTE, 2) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm, thank you, didn't know that!

@clash82 clash82 force-pushed the query-controller-for-menu branch from 7419c94 to 76339c8 Compare September 27, 2016 09:04
Copy link
Member

@bdunogier bdunogier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. But do you know why Travis is failing ?

@clash82
Copy link
Contributor Author

clash82 commented Sep 29, 2016

+1. But do you know why Travis is failing ?

it just stops working one day ;)
#31 (comment)

@clash82 clash82 merged commit ed7e360 into ezsystems:master Sep 29, 2016
@clash82 clash82 deleted the query-controller-for-menu branch September 29, 2016 12:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

5 participants