Its possible have two common? - yii2

im newest on Yii2. I know that yii2 advanced have a specific structure with 3 application (console, backend, frontend) and one core (common), and I can create others applications (secondFrondEnd, otherBackend, etc).
I investigated but I can't find information about is possible create a second common, or have any idea to create a structure that implement a estructure base->common->apps?? Idea its when I'll use gii crud, only overwrite the base with database changes, and common use to implement my specific methods.

I resolve this problem. I create a gii template that create a common/models/class and common/model/_base/baseclass. The class extends for base, and base class have a default code that gii generate.

Related

Is it possible to reference an existing ActiveRecord model from the classes generated with Gii?

There is an extension for Yii2 I'm using, and it provides a database table and an ActiveRecord model class to work with entities in that table. My other models are generated with Giiant. I want to reference the library model from my generated models, e.g. so relation properties like $myEntity->thatLibraryEntity are generated correctly by Giiant. Is it possible to do so?
I haven't found a way to do so in the documentation, and in the source code the closest thing to what I want is setting the BatchController::$tableNameMap configuration parameter in Giiant, but that seems to only rename the models, and I would like to tell Giiant which existing ActiveRecord to use for entities in a particular table.
I worked around it.
The generated models reference class app\models\ThatLibraryEntity for table that_library_entity. I created that class, and made it extend the library ActiveRecord model I wanted to use.

PrimeFaces built-in CRUD?

I'm pretty new to PrimeFaces and I'd need to setup a basic CRUD User Interface. From the showcase I can see there is a built-in Datatable parameter named editable to enable editing. I wonder if there is any built-in feature to enable also Adding and Deleting items.
If not, what would be the simplest way to achieve it ? Maybe using a Dialog component to collect the new items ?
Thanks
The simplest way to get a CRUD would be to reverse engineer it. Create your tables in a database and in Netbeans 7 or 8 (I use 8) create
Entity classes from database
JSF pages from entity classes
During the second point you can choose between Primefaces and plain JSF. If you prefer, you could also skip the first point and code the entity classes yourself instead, and tell the server to create the tables on start.
This will get a full CRUD running, complete with theming, menustructure and templating, using primefaces, facelets, beans, custom entity converters, EJB's, entities and JPA.
I like most of the generated code quite well and there is a lot to learn from it as a beginner. The result is a full page for the list and dialogs (via ui:include's) for create, view and edit.
I'd think Eclipse has something similar.

CRM 4.0 Custom Activity View

The problem: We need to display Activities with thier regarding objects fixed set of attributes.
Example:
Activity Type; Regarding Object Name; Regarding Object Status; Regarding Object Priority; ...
What is the best way to achieve that?
I'm thinking to solve this by:
Create a Custom entity and include all 'activitypointer' fields + additional fixed count regarding object fields.
Create a Database View that queries all required attributes from tables.
Create a RetrieveMultiple Plugin for newly created Custom entity fill it with data directly from Database.
Any other suggestions?
The only other way I would propose is a custom web application that mocks the normal views. You can use the CRM styles to make it look the same as other views. On load, have it retrieve all activities you want using SQL if on-premise or RetrieveMultiple if hosted. This way you would have more flexibility in terms of search and bringing in additional attributes and don't have to mess around with plugins.

Best Method for AS3 Data Services Update after Underlying Database Schema Changed?

I am using Flash Builder 4 to write Flex app. I originally used its php data service wizard to create the php class and related valueObject that interface with my database.
Now when I change my underlying database schema, what is the best way to update that php class and valueObject? I currently have to delete and recreate them using the wizard again. But this is not a good way as I may write customized routines in the php class in the future for more specific queries.
Any insight is appreciated. Thanks!

Putting Rails over top of an existing database

I have an application written in PHP/MySQL (symfony, to be specific) that I'd (potentially) like to rewrite in Rails. I know how to create scaffolding for tables that don't exist yet, but how do I get Rails to read my existing table structure and create scaffolding based on that?
Update: it turns out I can run the following command to get Rails to generate models for me:
rails generate scaffold Bank --no-migration
But it doesn't give me forms. I would prefer something that gives me forms.
The answer is db:schema:dump.
http://guides.rubyonrails.org/migrations.html
The easiest route is to pretend that you are writing a fresh app with a similar database schema - you can then create your models and migrations with the old schema in mind, but without being restricted by it. At a later stage, you can create a database migration script to copy all the old data into the new schema.
I'm doing this right now. The benefit of this approach is that you can take advantage of all of the rapid development tools and techniques provided by Rails (including scaffolds) without being slowed by trying to retrofit to the exact same schema.
However, if you do decide that you don't like this approach, and you do need to map your new models to existing tables, there are a number of configuration options provided by active record where you can override the convention over configuration naming patterns and map model names to tables names, set oddly named ID fields etc. For example:
class Mammals < ActiveRecord::Base
set_table_name "tbl_Squirrels"
set_primary_key :squirrel_id
end
The above will help Rails attempt to read your existing table, but success will depend upon how well the existing table structures matches Rails conventions. You may have to supply more configuration information to get it to work, and even then it might not work.
Finally, it may be worth considering the use of DataMapper which I believe is more suited to existing brownfield databases than ActiveRecord, because it allows you to map everything, but of course you will need to learn that API if you don't already know it.