$app = Factory::getApplication(); doesnt work

871 views
Skip to first unread message

pranay851

unread,
May 5, 2018, 5:14:48 AM5/5/18
to Joomla! General Development

Hello,

I was trying to read through the documentation on Joomla and can't figure out this part :-

why when i replace  $app = JFactory::getApplication(); 

                                              with

                                 $app = Factory::getApplication(); 

I get a class does not exist error

JFactory is a class that shows under Joomla 2.5 when i search the Joomla API site ( https://api.joomla.org/)

Factory   is a class that shows under Joomla 3.8 when i search the Joomla API site ( https://api.joomla.org/)

Also there is a mapping between these classes that i can find on GitHub (https://github.com/joomla/joomla-cms/blob/3.9-dev/libraries/classmap.php#L300)

so shouldn't   $app = Factory::getApplication();  work exactly the same as  $app = JFactory::getApplication(); ?




Mike Smith

unread,
May 5, 2018, 5:23:02 AM5/5/18
to joomla-de...@googlegroups.com
Checking through the source code of 3.8.7 it appears to use JFactory not Factory.

Mike

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

Hannes Papenberg

unread,
May 5, 2018, 5:59:19 AM5/5/18
to Joomla! General Development
Use \Factory::getApplication()

pranay851

unread,
May 5, 2018, 6:37:06 AM5/5/18
to Joomla! General Development
Yes,

 JFactory works, but the documentation for 3.8 says to use Factory instead. Confusing , not sure what is the best way to use the documentation without wasting time on errors that can be avoided? any suggestions ?


On Saturday, May 5, 2018 at 7:23:02 PM UTC+10, ms wrote:
Checking through the source code of 3.8.7 it appears to use JFactory not Factory.

Mike

On Sat, May 5, 2018 at 10:14 AM 'pranay851' via Joomla! General Development <joomla-de...@googlegroups.com> wrote:

Hello,

I was trying to read through the documentation on Joomla and can't figure out this part :-

why when i replace  $app = JFactory::getApplication(); 

                                              with

                                 $app = Factory::getApplication(); 

I get a class does not exist error

JFactory is a class that shows under Joomla 2.5 when i search the Joomla API site ( https://api.joomla.org/)

Factory   is a class that shows under Joomla 3.8 when i search the Joomla API site ( https://api.joomla.org/)

Also there is a mapping between these classes that i can find on GitHub (https://github.com/joomla/joomla-cms/blob/3.9-dev/libraries/classmap.php#L300)

so shouldn't   $app = Factory::getApplication();  work exactly the same as  $app = JFactory::getApplication(); ?




--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.

Hannes Papenberg

unread,
May 5, 2018, 6:38:13 AM5/5/18
to Joomla! General Development
Use \Factory::getApplication()

'pranay851' via Joomla! General Development <joomla-de...@googlegroups.com> schrieb am Sa., 5. Mai 2018, 12:37:
Yes,

 JFactory works, but the documentation for 3.8 says to use Factory instead. Confusing , not sure what is the best way to use the documentation without wasting time on errors that can be avoided? any suggestions ?

On Saturday, May 5, 2018 at 7:23:02 PM UTC+10, ms wrote:
Checking through the source code of 3.8.7 it appears to use JFactory not Factory.

Mike

On Sat, May 5, 2018 at 10:14 AM 'pranay851' via Joomla! General Development <joomla-de...@googlegroups.com> wrote:

Hello,

I was trying to read through the documentation on Joomla and can't figure out this part :-

why when i replace  $app = JFactory::getApplication(); 

                                              with

                                 $app = Factory::getApplication(); 

I get a class does not exist error

JFactory is a class that shows under Joomla 2.5 when i search the Joomla API site ( https://api.joomla.org/)

Factory   is a class that shows under Joomla 3.8 when i search the Joomla API site ( https://api.joomla.org/)

Also there is a mapping between these classes that i can find on GitHub (https://github.com/joomla/joomla-cms/blob/3.9-dev/libraries/classmap.php#L300)

so shouldn't   $app = Factory::getApplication();  work exactly the same as  $app = JFactory::getApplication(); ?




--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.

pranay851

unread,
May 5, 2018, 6:48:15 AM5/5/18
to Joomla! General Development

$app =  \Factory::getApplication(); 

gives the same error :-

CLASS 'FACTORY' NOT FOUND

On Saturday, May 5, 2018 at 8:38:13 PM UTC+10, Hannes Papenberg wrote:
Use \Factory::getApplication()

'pranay851' via Joomla! General Development <joomla-de...@googlegroups.com> schrieb am Sa., 5. Mai 2018, 12:37:
Yes,

 JFactory works, but the documentation for 3.8 says to use Factory instead. Confusing , not sure what is the best way to use the documentation without wasting time on errors that can be avoided? any suggestions ?

On Saturday, May 5, 2018 at 7:23:02 PM UTC+10, ms wrote:
Checking through the source code of 3.8.7 it appears to use JFactory not Factory.

Mike

On Sat, May 5, 2018 at 10:14 AM 'pranay851' via Joomla! General Development <joomla-de...@googlegroups.com> wrote:

Hello,

I was trying to read through the documentation on Joomla and can't figure out this part :-

why when i replace  $app = JFactory::getApplication(); 

                                              with

                                 $app = Factory::getApplication(); 

I get a class does not exist error

JFactory is a class that shows under Joomla 2.5 when i search the Joomla API site ( https://api.joomla.org/)

Factory   is a class that shows under Joomla 3.8 when i search the Joomla API site ( https://api.joomla.org/)

Also there is a mapping between these classes that i can find on GitHub (https://github.com/joomla/joomla-cms/blob/3.9-dev/libraries/classmap.php#L300)

so shouldn't   $app = Factory::getApplication();  work exactly the same as  $app = JFactory::getApplication(); ?




--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.

To post to this group, send email to joomla-de...@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.

Hannes Papenberg

unread,
May 5, 2018, 11:10:15 AM5/5/18
to joomla-de...@googlegroups.com
\Joomla\CMS\Factory::getApplication()

As you can see in the classmap that you mentioned yourself, it registers
the alias JFactory for the class in the namespace \Joomla\CMS\Factory

Hannes

Am 05.05.2018 um 12:48 schrieb 'pranay851' via Joomla! General Development:
>
> $app =  \Factory::getApplication();
>
> gives the same error :-
>
> CLASS 'FACTORY' NOT FOUND
>
> On Saturday, May 5, 2018 at 8:38:13 PM UTC+10, Hannes Papenberg wrote:
>
> Use \Factory::getApplication()
>
> 'pranay851' via Joomla! General Development
> <joomla-de...@googlegroups.com <javascript:>> schrieb am Sa., 5. Mai
> 2018, 12:37:
>
> Yes,
>
>  JFactory works, but the documentation for 3.8 says to use
> Factory instead. Confusing , not sure what is the best way to
> use the documentation without wasting time on errors that can be
> avoided? any suggestions ?
>
> On Saturday, May 5, 2018 at 7:23:02 PM UTC+10, ms wrote:
>
> Checking through the source code of 3.8.7 it appears to use
> JFactory not Factory.
>
> Mike
>
> On Sat, May 5, 2018 at 10:14 AM 'pranay851' via Joomla!
> General Development <joomla-de...@googlegroups.com> wrote:
>
>
> Hello,
>
> I was trying to read through the documentation on Joomla
> and can't figure out this part :-
>
> why when i replace *$app =* *JFactory::getApplication(); *
> *
> *
> *with*
> *
> *
> ***$app =**Factory::getApplication(); *
> *
> *
> *I get a class does not exist error*
> */_
> _/*
> JFactory is a class that shows under Joomla 2.5 when i
> search the Joomla API site ( https://api.joomla.org/)
>
> Factory is a class that shows under Joomla 3.8 when i
> search the Joomla API site ( https://api.joomla.org/)
>
> Also there is a mapping between these classes that i can
> find on GitHub
> (_https://github.com/joomla/joomla-cms/blob/3.9-dev/libraries/classmap.php#L300_
> <https://github.com/joomla/joomla-cms/blob/3.9-dev/libraries/classmap.php#L300>)
>
> so shouldn't ***$app =**Factory::getApplication();  work
> exactly the same as **$app =**JFactory::getApplication(); ?*
> */
> /*
>
> **//___^
>
> --
> You received this message because you are subscribed to
> the Google Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails
> from it, send an email to
> joomla-dev-gene...@googlegroups.com.
> To post to this group, send email to
> joomla-de...@googlegroups.com.
> Visit this group at
> https://groups.google.com/group/joomla-dev-general
> <https://groups.google.com/group/joomla-dev-general>.
> For more options, visit
> https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the
> Google Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to
> joomla-dev-gene...@googlegroups.com <javascript:>.
> To post to this group, send email to
> joomla-de...@googlegroups.com <javascript:>.
> <https://groups.google.com/group/joomla-dev-general>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to joomla-dev-gene...@googlegroups.com
> <mailto:joomla-dev-gene...@googlegroups.com>.
> To post to this group, send email to joomla-de...@googlegroups.com
> <mailto:joomla-de...@googlegroups.com>.

pranay851

unread,
May 5, 2018, 7:42:45 PM5/5/18
to Joomla! General Development
Thank You ! Hannes you nailed it , This works. :-)
However the Joomla documentation is misleading on  https://api.joomla.org 

Thanks 
Pranay
>                 To post to this group, send email to
>                 joomla-de...@googlegroups.com.
>                 Visit this group at
>                 https://groups.google.com/group/joomla-dev-general
>                 <https://groups.google.com/group/joomla-dev-general>.
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "Joomla! General Development" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         joomla-dev-general+unsub...@googlegroups.com <javascript:>.
>         To post to this group, send email to
>         joomla-de...@googlegroups.com <javascript:>.
>         Visit this group at
>         https://groups.google.com/group/joomla-dev-general
>         <https://groups.google.com/group/joomla-dev-general>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
Reply all
Reply to author
Forward
0 new messages