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
[4.0.0] Tag no longer uses static methods #12379
Conversation
Hm... Is it good? |
Yea, don't like creating new tag object in each method. |
Yea i know, but it should happen then in this PR everywhere i think. As well this would require Tag in factorydefault perhaps. |
@Jurigag of course Tag must be in factorydefault. So, maybe it's time to refactor Tag as service for 4 version of Phalcon? |
Static methods are glorified functions with namespaces. Using them in this way means we can't override them with a custom tag class and they're hard dependencies. It defeats the whole point of object-oriented programming. For all intents and purposes, they're effectively evil. :p This PR is still a work in progress and I plan to get the 'tag' service from the DI instead of just creating a new instance every time. Unfortunately the PR doesn't pass in its current form so I'm focusing on that first. |
|
||
let output = "", | ||
html = "", | ||
joinedContent = ""; | ||
|
||
let tag = new Tag(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SidRoberts Can we seek it in the Di first?
|
||
if !collectionName { | ||
let collection = this->getCss(); | ||
} else { | ||
let collection = this->get(collectionName); | ||
} | ||
|
||
return this->output(collection, ["Phalcon\\Tag", "stylesheetLink"], "css"); | ||
let tag = new Tag(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same
|
||
if !collectionName { | ||
let collection = this->getJs(); | ||
} else { | ||
let collection = this->get(collectionName); | ||
} | ||
|
||
return this->output(collection, ["Phalcon\\Tag", "javascriptInclude"], "js"); | ||
let tag = new Tag(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
Addressed in #13656 |
No description provided.