orm

Doctrine Is not a valid entity or mapped super class

喜你入骨 提交于 2021-01-28 16:29:28
问题 i have a problem with doctrine and i getting this error from auto generated entity file "Class "Users" is not a valid entity or mapped super class.". File and comments inside looks like fine i dont understund why or i something miss? Some piece of code <?php use Doctrine\ORM\Mapping as ORM; /** * Users * * @ORM\Table(name="users", uniqueConstraints={@ORM\UniqueConstraint(name="username", columns={"username"})}) * @ORM\Entity */ class Users { /** * @var integer * * @ORM\Column(name="userid",

Create form of Category with SubCategories on Symfony

筅森魡賤 提交于 2021-01-28 12:03:28
问题 I have two entities : Category and SubCategory. One category have 0 or many subcategory. They are related with Many-to-One relation. I don't imagine how i can make a form with subcategories group by category like this : CATEGORY 1 : - SubCategory 1 - SubCategory 2 CATEGORY 2: - SubCategory 1 - SubCategory 2 My form actual : class CategorieType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder,

Object Relational Mapping from CSV with PowerShell?

ぃ、小莉子 提交于 2021-01-28 10:51:54
问题 "How to iterate through CSV data from PowerShell ?" would perhaps be an alternate question title. This output is fine: PS /home/nicholas> PS /home/nicholas> $flat Date Region New_Tests Total_Tests Positivity Turn_Around ---- ------ --------- ----------- ---------- ----------- 2020-01-23 BC 2 2 0 32 2020-01-23 Fraser 0 0 0 0 2020-01-23 Interior 0 0 0 0 2020-01-23 Northern 0 0 0 0 2020-01-23 Unknown 0 0 0 0 2020-01-23 Vancouver Coastal 2 2 0 32 2020-01-23 Vancouver Island 0 0 0 0 .. but I'd be

Object Relational Mapping from CSV with PowerShell?

最后都变了- 提交于 2021-01-28 10:49:49
问题 "How to iterate through CSV data from PowerShell ?" would perhaps be an alternate question title. This output is fine: PS /home/nicholas> PS /home/nicholas> $flat Date Region New_Tests Total_Tests Positivity Turn_Around ---- ------ --------- ----------- ---------- ----------- 2020-01-23 BC 2 2 0 32 2020-01-23 Fraser 0 0 0 0 2020-01-23 Interior 0 0 0 0 2020-01-23 Northern 0 0 0 0 2020-01-23 Unknown 0 0 0 0 2020-01-23 Vancouver Coastal 2 2 0 32 2020-01-23 Vancouver Island 0 0 0 0 .. but I'd be

How to return exact matches for ManyToMany queries

这一生的挚爱 提交于 2021-01-28 07:14:29
问题 let's say I have a model like class Group: users = ManyToMany(User, related_name='groups') and I have groups with a different mixture of users group1 = Group(users=[user1]) group2 = Group(users=[user1, user2]) group3 = Group(users=[user1, user2, user3]) How would I go about querying for groups only with user1 and user2 ? I'd like to do something that's like Group.objects.filter(users=[user1, user2]) -> [group2] but I'm getting TypeError: Field 'id' expected a number but got [<User: user1>,

Mapping inheritance in EntityFramework Core

孤者浪人 提交于 2021-01-27 21:10:22
问题 I'm using EntityFramework Core, Code First and Fluent Api to define model database, and i've follow situation about strategy of map inheritance: public class Person { public int Id { get; set; } public string Name { get; set; } } public class User : Person { public string UserName { get; set; } public string Password { get; set; } } public class Employee : Person { public decimal Salary { get; set; } } public class Customer:Person { public long DiscountPoints { get; set; } } Business logical

SequelizeJS: How to include association (join) across multiple databases without using raw query

允我心安 提交于 2021-01-27 14:54:05
问题 Suppose, there is "Account" table in DB "A", and there is "ConversationHistory" table in DB "B". My pseudo initialized script is: // Connection Script var db1 = new Sequelize("A", user, password) var db2 = new Sequelize("B", user, password) // Association Account.hasMany(ConversationHistory, {foreignKey: "sender_id", as: "conversations", constraints: false}) ConversationHistory.belongsTo(Account, {foreignKey: "sender_id", as: "sender", constraints: false}); // But when I use include in

SequelizeJS: How to include association (join) across multiple databases without using raw query

三世轮回 提交于 2021-01-27 14:35:35
问题 Suppose, there is "Account" table in DB "A", and there is "ConversationHistory" table in DB "B". My pseudo initialized script is: // Connection Script var db1 = new Sequelize("A", user, password) var db2 = new Sequelize("B", user, password) // Association Account.hasMany(ConversationHistory, {foreignKey: "sender_id", as: "conversations", constraints: false}) ConversationHistory.belongsTo(Account, {foreignKey: "sender_id", as: "sender", constraints: false}); // But when I use include in

Is a ORM the right tool to use for migrating data?

一曲冷凌霜 提交于 2021-01-27 14:09:58
问题 Background We are in the process of upgrading a legacy import tool, what it does is it moves data from one database attached to SQL Server to a 2nd database on the same server with a different schema performing the translations and mapping along the way. Here is a example to help explain what is happening Say the source database has one table called Client_Info and the destination table has two tables named Clients and Cities Source.dbo.Client_Info +-----------+----------+----------+-------+

Hibernate native query optional parameter throws 'operator does not exist: bigint = bytea'

南楼画角 提交于 2021-01-27 06:31:37
问题 I have a query as follows: SELECT id FROM table1 WHERE (:param IS NULL OR id_or_smth = :param) The param parameter is optional, therefore it can be null I createed a javax.persistance.Query To which I then setParameter("param", null) And when I called getResultList() I got the following error: Caused by: org.hibernate.exception.SQLGrammarException: ERROR: operator does not exist: bigint = bytea how can i handle this? 回答1: HQL and Criteria can only work when you specify an actual Entity