Drupal 7 - bulk reference nodes using entity reference fields - drupal-7

I have 2 content types; publisher and campaign. When I create a campaign node, I then need to use entity reference to reference the publishers who will work on this campaign. I have added a reference entity field to my campaign content type however, I need to search and filter through my publishers to find the ones in the right category, then bulk add them using some kind of checkbox next to each. Anyone any idea how I can do this?
Thanks for any help

It looks like the Entity Reference View Widget module might do what you are looking for.

Related

How to create a new object with an aggregated reference to an existing object?

I'm working with Bonita BPM 7.5 and in my contract I have defined an object with an aggregated relationship to another object (complex data), my problem starts when in UI designer I show a table of existing objects (aggregated object) to the user for select which object will be referenced by the new object. Do you have any clues to do that? In particular, to create a new object linked to an existing object in DB. In all cases I'm using BDM accesors.
Tahnks in advance.
Regards...
I think the problem you have isn't so much a data matching problem, BDM accessors are the right approach here. Rather the problem is in the visualization of the data for the tables.
Have you considered creating a custom ReST API endpoint to "flatten" the data from your aggregated table for presentation purposes?

field_data_commerce_line_items vs commerce_line_item in Drupal Commerce

I've realized that there are two tables with similar names in my DB:
field_data_commerce_line_items and commerce_line_item.
Can someone explain the purpose or reason of having them? I mean the difference between them.
My understanding is that field_data_commerce_line_items is a reference field on an order that references a line in the commerce_line_item table on field_data_commerce_line_items.commerce_line_items_line_item_id = commerce_line_item.line_item_id.
However still not getting the overall picture.
In Drupal an entity can reference multiple entities via a field reference. The references aren't necessarily unique, but the entities are.
field_data_commerce_line_items is a multi-value field reference that associates Line Item entities to a specific Order.
commerce_line_item represents the unique Line Item entity.

What is Entity Object Instance?

I understand that Entity Object Definition is XML data that represents metadata and corresponds to DB table.
Example:
<Entity
xmlns="http://xmlns.oracle.com/bc4j"
Name="Departments"
Version="11.1.1.53.3"
DBObjectType="table"
DBObjectName="DEPARTMENTS"
AliasName="Departments"
BindingStyle="OracleName"
UseGlueCode="false">
<DesignTime>
<AttrArray Name="_publishEvents"/>
</DesignTime>
<Attribute
Name="DepartmentId"
IsNotNull="true"
Precision="4"
Scale="0"
ColumnName="DEPARTMENT_ID"
SQLType="NUMERIC"
Type="oracle.jbo.domain.Number"
ColumnType="NUMBER"
TableName="DEPARTMENTS"
PrimaryKey="true">
<DesignTime>
<Attr Name="_DisplaySize" Value="22"/>
</DesignTime>
</Attribute>
I understand that Entity Attributes corresponds to DB table columns.
BUT I CAN`T understand what is Entity Object Instance. I know that it corresponds to one single row from DB table and for every row there is a different EOI, but where can I find it? Any example and simple explanation would be helpful! :)
Entity Object Instance is something like the row data & business logic object oriented representation. Imagine you need to load data from a DB table into memory, you need a collection of rows (for example List<DbTableRow>), each row (DbTableRow) is an object that contains properties according to each table column data types and it's values; Entity Object Instance is something like each DbTableRowobject item of the list.
Hope it helps...
The following URL will have examples about ADF Entity Object
About Entity and View Object
Entity and View Java classes
I know this is an old post. Hope it will be useful for others

Many-to-Many relationship in Zend 2 Framework

I use the Zend 2 Framework to build my web application. I implemented my database table models by this tutorial: http://framework.zend.com/manual/2.1/en/user-guide/database-and-models.html
I have a many-to-many relationship between two models in my database. To get data from them I googled and found this link: http://mattmccormick.ca/2010/04/24/how-to-easily-create-models-and-table-relationships-in-zend-framework/
The problem is that all the table models extends from Zend_Db_Table_Abstract in the example. I don't know how to get data from the models.
I have a table containing votings, every voting has a unique hash id. Every voting also has tags. Therefore I defined a table tags with all the tags available and a voting_tag_map where all many-to-many relationships are mapped.
What I have tried so far is the following, that's code from my VotingTable class:
public function getTagsByVoting($votingHash){
$select = $this->tableGateway->getSql()->select();
$select->from(array('v' => 'voting'))
->join('voting_tag_map', 'v.voting_id=voting_tag_map.voting_id')
->join('tags', 'voting_tag_map.tag_id=tags.tag_id');
$resultSet = $this->tableGateway->selectWith($select);
return $resultSet;
}
It says then:
Since this object was created with a table and/or schema in the constructor, it is read only.
Thats because of the from() method. If I delete the from() method, it says:
Statement could not be executed
Can anyone help me please?
Since this object was created with a table and/or schema in the constructor, it is read only.
This error is because you are trying to set the table name in the from clause, but it's already been set in the contructor of the TableGateway, and you can't change it once set.
If you really need to do this then you can extens AbstractTableGateway yourself then you won't have to add a string tablename to the contructor, but you don't really need to use an alias on your main table...
The SQL error you get when you comment out the from() method will be due to your referencing the votes table as it's alias 'v' in your join, when you are not using the alias v, try changing it to 'voting.XXX' from 'v.XXX'

Database : Design table with dynamic tags

In my table, there is a list of items, those items have some attribute that is dynamic. it means it can change through run-time, not design-time.
For example, a list of dishes. So, a dish can be a fish/dessert/drink/.... Those attributes will help my application filter it later base on user. And those attribute is inputted by manager through run-time.
So, I don't know how to design a table with dynamic attribute like this. Who has any ideas, please tell me.
Thanks :)
You could add a type column to your table.
Another approach would be to have something like a tag. Where you item has many tags.
However, more details on what you're trying to accomplish would be necessary in order to give a better answer.
Are you new to database design? you should probably look at some db design tutorials:
http://www.ntu.edu.sg/home/ehchua/programming/sql/Relational_Database_Design.html
http://www.databaseanswers.org/tutorial4_getting_started_with_db_design/index.htm
The attributes that you mentioned could be stored as data in some database table under column dishes.
And then you could relate these dishes with your users.

Resources