Hi Alberto,
I have this same question. I have several projects that share the same
backend app. It would be nice if we had in CakePHP 3 an easier and
standardized way to do this. The backend in a separate app facilitates and
simplifies the development of frontends. An easy way for projects with
multiple app's.
Em terça-feira, 25 de março de 2014 20h19min20s UTC-3, bato escreveu:
>
> Hi there,
>
> I played a bit with new ORM and now I'm starting to port BEdita to Cake 3.
> BEdita is a Semantic Content Management Framework developed with cake 1.3.
> The backend is a cake app that can manage multiple frontends data. Every
> frontend is a cake app too that uses a set of api that are exposed from
> backend app.
>
> Backend and frontend apps share cakephp lib and backend models, behaviors,
> helpers are reachable from frontends since they are added to paths with
> App::build().
>
> Now I try to figure out as reproduce the "same" situations with cake 3 and
> I would ask some advice.
>
> I'm starting creating the backend app with composer, then I added frontend
> app by hand beacuse I want to reuse cake core installed in backend app.
> So my directory structure is
>
> - bedita: containing app (Bedita\\ namespace) and vendor with cakephp
> - frontend-app: clean cakephp app skeleton
>
>
> ├── bedita
> │ ├── Bedita
> │ ├── Module
> │ ├── Plugin
> │ ├── Test
> │ ├── tmp
> │ ├── vendor
> │ └── webroot
> └── frontend-app
> ├── App
> ├── Plugin
> ├── Test
> ├── tmp
> ├── vendor
> └── webroot
>
> To use cake and bedita in frontend app I managed App/config/paths.php and
> App/config/bootstrap.php
>
> In App/config/paths.php I added the path to bedita folder and modified
> CAKE_CORE_INCLUDE_PATH to use that.
> In App/config/bootstrap.php I change composer autoload path to
> bedita/vendor/autoload.php
> and added to it App namespace
>
> // Use composer to load the autoloader.
> if (file_exists(BEDITA_CORE_PATH . '/vendor/autoload.php')) {
> $loader = require BEDITA_CORE_PATH . '/vendor/autoload.php';
> $loader->addPsr4('App\\', APP);
> }
>
> After that in frontend app PagesController I am able to do:
>
> $images = TableRegistry::get('Images', [
> 'className' => 'Bedita\Model\Table\ImagesTable'
> ]);
>
> The only thing I had to pay attention is how to add behavior in Bedita
> Table objects. I had to specify the behavior className to avoid errors
> using those Table objects in frontend app.
>
> $this->addBehavior('BeditaObject', [
> 'className' => 'Bedita\Model\Behavior\BeditaObjectBehavior'
> ]);
>
>
> So I ask you CakePHP core dev/guru if it is the right way to handle this
> case or if you have some suggestion or advice.
>
> regards
> Alberto
>
>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.