Tidy Up Conversation Editor base class

PHPDocs

Added the class properties as protected variables, forcing the use of getters and setters

Switched out some legacy execute functions with the new doctrine functions

Added a new function, createFromRecord, which can be used to instantiate an object so that we don't have duplicate code for doing this when looking up by handle vs ID.

Switched the getList to have an optional pkgID param to eliminate redundant code between that and the getListByPackage function

Changed the getList function to run a query that gets all records, and makes use of the new createFromRecord() function in order to instantiate the objects, but this cuts down on the number of queries that have to get one (instead of 1 query for each record + a query to lookup all the handles, it's not just 1 query)


whew... sorry this was just going to be a PHPDoc commit but the more I got into it the more opportunities I found, I'll try to make my commits a bit more granular next time
Ya, copy and paste looks to have gotten me in trouble. I'll put up a pr to
fix tonight if nobody else gets to it. Might write done unit tests for it
while I'm at it.
On Aug 23, 2014 11:48 AM, "Takuro Hishikawa" <notifications@github.com>
wrote:

> In web/concrete/src/Conversation/Editor/Editor.php:
>
> > +     * Deactivates all other Conversation Editors, and activates the current one
> > +     */
> > +    public function activate()
> > +    {
> > +        $db = Loader::db();
> > +        static::deactivateAll();
> > +        $db->update('ConversationEditors', array('cnvEditorIsActive' => 1), array('cnvEditorID' => $this->cnvEditorID));
> > +    }
> > +
> > +    /**
> > +     * Function used to deactivate
> > +     */
> > +    protected function deactivateAll()
> > +    {
> > +        $db = Loader::db();
> > +        $db->update('ConversationEditors', array('cnvEditorIsActive' => 1), array());
>
> Install fails with this empty array. And, I think cnvEditorIsActive
> values should be 0 in deactivateAll method.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/concrete5/concrete5-5.7.0/pull/756/files#r16631345>.
>