Move contact lookup outside of the Article and Articles Query (2.5.x)

Fix the Contact Join problem for 2.5 (which is feature frozen) by removing the contact portion of the Article and Articles Query, and then adding the Contact ID lookup in the item resultset loop.

The 2.5.x change is very isolated, only impacts the model, and does not introduce a new feature for the plugin that is in 3.x or any layout changes.

This change fixes:
- The current SQL Server failure.
- Any duplicated content due to multiple contacts assigned to authors.
- Any dropped content due to no contact assigned to the author.

There are no BC issues.  
First, see if it already is that way in core.

Second, put in a PR for any changes.




On Wed, Jul 23, 2014 at 12:51 PM, Jefersson Nathan <notifications@github.com
> wrote:

> In components/com_content/models/article.php:
>
> > @@ -245,6 +232,36 @@ public function &getItem($pk = null)
> >  		return $this->_item[$pk];
> >  	}
> >
> > +    /**
> > +     * Retrieve Contact
> > +     *
> > +     * @param   int    $created_by
> > +     *
> > +     * @return  mixed|null|integer
> > +     */
> > +    protected function getContactID($created_by)
> > +    {
> > +        $db = JFactory::getDbo();
> > +        $query = $db->getQuery(true);
> > +        $query->clear();
> > +
> > +        $query->select('MAX(contact.id) AS contactid');
>
> @AmyStephen <https://github.com/AmyStephen> can be $db->quoteName('MAX(
> contact.id)', 'contactid')
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/joomla/joomla-cms/pull/1627/files#r15303298>.
>