What Belongs to the Aggregate Root

After doing even MORE research, I think I have the answer to my question. Paul Stovell had this slightly edited response to a similar question on the DDD messageboard. Substitute “Customer” for “Employee”, and “Order” for “Violation” and you get the idea. Just because Customer references Order doesn’t necessarily mean Order falls within the Customer … Read more

how to sort an entity’s arrayCollection in symfony2

You should be able to use the @ORM\OrderBy statement which allows you to specify columns to order collections on: /** * @ORM\OneToMany(targetEntity=”BizTV\ContentManagementBundle\Entity\Content”, mappedBy=”container”) * @ORM\OrderBy({“sort_order” = “ASC”}) */ private $content; In fact this may be a duplicate of How to OrderBy on OneToMany/ManyToOne Edit Checking for implementation advice it appears that you must fetch the … Read more

HTML5: which is better – using a character entity vs using a character directly?

If the encoding is UTF-8, the normal characters will work fine, and there is no reason not to use them. Browsers that don’t support UTF-8 will have lots of other issues while displaying a modern webpage, so don’t worry about that. So it is easier and more readable to use the characters and I would … Read more

JPA 2.0: Adding entity classes to PersistenceUnit *from different jar* automatically

There are several way to solve it: As described in Do I need <class> elements in persistence.xml?, you can set hibernate.archive.autodetection property and Hibernate should be able to look up all annotated classes from classpath. However, that’s not JPA spec compliant. If you are using Spring, from Spring 3.1.2 (or probably even a bit earlier), … Read more

Convert XML/HTML Entities into Unicode String in Python [duplicate]

The standard lib’s very own HTMLParser has an undocumented function unescape() which does exactly what you think it does: up to Python 3.4: import HTMLParser h = HTMLParser.HTMLParser() h.unescape(‘&copy; 2010′) # u’\xa9 2010’ h.unescape(‘&#169; 2010′) # u’\xa9 2010’ Python 3.4+: import html html.unescape(‘&copy; 2010′) # u’\xa9 2010’ html.unescape(‘&#169; 2010′) # u’\xa9 2010’

How do I unescape HTML entities in a string in Python 3.1? [duplicate]

You could use the function html.unescape: In Python3.4+ (thanks to J.F. Sebastian for the update): import html html.unescape(‘Suzy &amp; John’) # ‘Suzy & John’ html.unescape(‘&quot;’) # ‘”‘ In Python3.3 or older: import html.parser html.parser.HTMLParser().unescape(‘Suzy &amp; John’) In Python2: import HTMLParser HTMLParser.HTMLParser().unescape(‘Suzy &amp; John’)

Why not use an IoC container to resolve dependencies for entities/business objects?

The first question is the most difficult to answer. Is it bad practice to have Entities depend on outside classes? It’s certainly not the most common thing to do. If, for example, you inject a Repository into your Entities you effectively have an implementation of the Active Record pattern. Some people like this pattern for … Read more

What is the difference between “LINQ to Entities”, “LINQ to SQL” and “LINQ to Dataset”

all of them are LINQ – Language Integrated Query – so they all share a lot of commonality. All these “dialects” basically allow you to do a query-style select of data, from various sources. Linq-to-SQL is Microsoft’s first attempt at an ORM – Object-Relational Mapper. It supports SQL Server only. It’s a mapping technology to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)