I have an important Symfony project, in which I have different apps.
I'd like to have different databases, one for each apps.
I've find that I can have multiple database connections, but when I create schema, models forms and filters symfony put all these classes into /lib/folder.
Is there a way for create models, forms, filters for each application based on his own schema, and put the resulting classes into somthing like /apps/myApp/lib?
Thankyou very much...
You can use the "package" parameter in your schema like so:
Model:
connection: doctrine
package: your_package
tableName: model
columns:
...
Related
I want to use backpack to manupulate REST api data in my project.
I always used a backpack to administrate data using eloquent models without REST.
But now I want to request the data from api in controllers and show it in backpack crud tables.
I can request the data with guzzle, add multiple columns dynamically with $this->crud->addColumns();.
Could you tell me what method I should use inside my EntityCrudController setup() method to add the data like this? Thanks.
Using Laravel 5.8 with Backpack 3.5.
For REST using Slim framework 3.
I’m afraid it is not recommended to use Backpack with your custom REST API. Backpack depends on Eloquent to do everything related to database interaction, so you’d have to overwrite a lot of things.
While technically it is possible (you could create the operation methods in your EntityCrudController like store(), update(), destroy(), search() and call your API instead of Eloquent - it would be a lot of work. And it will probably be easier to just create CRUDs without Backpack.
I have a WP7 project, which will invoke a REST web service in Azure (MVC4 WebApi).
My WP7 project has models that it serializes to JSON and then sends to the web service.
The web service deserializes the data sent from WP7 and instantiates the models again before saving them to Azure Table Storage.
How can I share the Model classes between the projects? Right now I'm just copying the cs files over, and I have to update both sets if I make a change to the models. I was hoping a simple class library project would be able to be referenced from both projects, but WP7 couldn't handle that.
What should I do?
Thanks!
There are many solutions for this issue:
You could use a T4 template to read the entity and generate a class your WP7 project that only contains the properties of the object without reference to the Table Storage specifics (like TableStorageEntity): http://weblogs.asp.net/cibrax/archive/2009/03/11/code-generation-with-t4-an-entities-to-dto-example.aspx
You could split your entity over 2 files, one with the TableStorage specifics like TableStorageEntity and one file containing only the properties of the entity (use partial classes for this). Then you can add the file containing only the properties in your WP7 project as a link.
Create a DTO (or whatever you call it) class manually and use something like AutoMapper to map between the DTO and the TableStorage entity. Store the DTO in a portable library so it can be used by every kind of project. In my opinion this is the best solution since you don't want to completely expose your entities to "the outside world". An example would be a list of users. You wouldn't want to return all fields including password, hash... and other sensitive info. It would be better to have a separate class that only contains the info you want to expose externally.
First of all, I have read a lot of post relating this issue like:
Asp.net MVC RouteBase and IoC ,
Tenant-specific routes for dynamically loaded modules ,
and many others.
What I want is:
- Dynamically create pages like tenant1.mydomain.com, tenant2.mydomain.com, etc.
- My tenants will have the same functionality but just different content, styles, title, etc.
I have tried extending RouteBase class but have read that is not a clean solution.
Then I have tried creating a custom RouteConstraint like above posts recommend but not succeded.
Help me!
Thanks!
I have achieved this by doing two things. 1) was to provide functionality to select the correct content by providing the repositories via a factory which was handed the URL on creation. The issue here is that it might be possible to fetch the wrong data via relationships from entities that themselves don't have a tennantid field.
2) Is a basic custom view engine which looks up the host part of the URL and would look for a client specific template (via a folder structure) if the template was found it was used, otherwise the default template is returned.
Between these two I've got a system that delivers (in my case) multiple websites via the same bespoke CMS and product management tool.
When defining simple DataMapper resource, it sets default storage engine to InnoDB, but I need MyISAM, any way to override InnoDB?
I haven't found a way using the dm-mysql-adapter but dm-mysql looks promising.
I had originally submitted a request
to the DataMapper team to include an
option to allow MySQL database users
the ability to specify table options
in their DataMapper models. My needs
were around data warehousing and I
wanted to use a different storage
engine like Infobright. Unfortunately
this request was denied because
dm-core could have ended up looking
like spaghetti if my request were
approved. Mind you I'm oversimplifying
the argument, but I understood where
they were coming from. As a result, I
bring you dm-mysql!
Want more control over your database tables in DataMapper?
I am new to Codeigniter and I am thinking about the use of this framework in my new project.
I am going to need these two extensions. Before digging into too deep, I wonder if anyone already has experience with them and can kindly give some insights on whether there is any compatibility issue when they are used together.
Modular Extensions - HMVC
http://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home
Datamapper ORM
http://datamapper.exitecms.org/
I believe there are many others who are going to use these two extensions together because they are actually very popular ones. So, many people are going to benefit from this thread.
Many many thanks to you all.
Firstly a caveat : I have used the HMVC extension but not the Datamapper ORM.
As far as I see it the two extensions have separate goals. In principle I cannot see a conflict.
The HMVC extension is useful where your view is composed of multiple sub-views. It allows you to modularise your application so that your views can be built from the output of multiple controller actions.
The Datamapper ORM allows you to map the data in your database directly onto PHP objects in your application. It saves you the cruft of writing SQL queries to pull rows from a database and hydrate objects in your application. You define what table your model is loaded from and how it is related to the other models in your application. The Datamapper generates the queries to perform the CRUD operations behind the scenes.
HMVC is concerned with how you structure your application. The Datamapper ORM is concerned with how you build your models. I don't see how the Datamapper would stop you using HMVC or vice-versa.
I'd also suggest taking a look at Doctrine ORM. It's a very powerful ORM framework that I've been using for the past year or so in all my CodeIgniter projects and works really well without any compatibility issues or such.
Tutorial for installing Doctrine with CodeIgniter.