Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DomCrawler] Abstract URI logic and crawl images #13620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

[DomCrawler] Abstract URI logic and crawl images #13620

wants to merge 3 commits into from

Conversation

valeriangalliat
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #12429
License MIT
Doc PR symfony/symfony-docs#4971

All the URI parsing logic is externalized in the AbstractUriElement
class, implementing the UriElementInterface interface.

The AbstractUriElement class have two abstract methods:

* setNode: validate the DOMElement node according to the concrete class
  rules, and set $this->node.
* getRawUri: get the raw URI from $this->node.

The Link and Form classs now extends AbstractUriElement (Form don't have
to extend Link anymore).

This refactor is desirable for #12429.
@valeriangalliat
Copy link
Contributor Author

The DomCrawler tests are passing, but there's a problem with FrameworkBundle. I don't think it's caused by my changes since I have the same failures on the current master.

A new Image class is added, extending AbstractUriElement, to leverage
URI methods for the HTML img src attribute.

Two methods are added to the Crawler class, image and images, that are
the equivalent of link and links for images.
@wouterj
Copy link
Member

wouterj commented Feb 7, 2015

This can easily made BC by still letting Form extend Link. This means both implement the interface and both extend the abstract class. This can then be merged into Symfony 2.7 and the extend Link can be removed in Symfony 3.0.

This would allow users to already make their code compatible for Symfony 3.0.

This is a fix for BC with Symfony 2.7. It should be reverted in 3.0.
@valeriangalliat
Copy link
Contributor Author

@wouterj I just fixed this in a separate commit, so it's easy to revert in Symfony 3.0 (and I edited the original message to set "BC breaks?" to "no". Do I close this PR and make another one targeting the 2.7 branch (I have it ready on top of 2.7)? Also how to handle the changelog for both 2.7 and 3.0?

@stof
Copy link
Member

stof commented Feb 10, 2015

@valeriangalliat please send a PR to 2.7 yes. It is better to ship new features in 2.7 rather than making them wait until November for 3.0. Once it is merged, you would then send a second PR with the 3.0 cleanup.

/**
* @var string The method to use for the element URI
*/
protected $method;
Copy link
Member

Choose a reason for hiding this comment

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

please make these private (we have public getters for them anyway)

Copy link
Member

Choose a reason for hiding this comment

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

hmm, no. These properties are currently protected in Link, so we cannot make them private yet

jakzal added a commit that referenced this pull request Feb 4, 2016
…riangalliat)

This PR was squashed before being merged into the 3.1-dev branch (closes #17585).

Discussion
----------

 [DomCrawler] Abstract URI logic and crawl images

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12429
| License       | MIT
| Doc PR        | symfony/symfony-docs#4971

This is a backward-compatible version of #13620, and a rebase of #13649 on current `master`.

Commits
-------

1553b07  [DomCrawler] Abstract URI logic and crawl images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants