Kibicujecie polskim piłkarzom?

autor: 05.12.2016 15:28

06.12.2016 12:01

The @var tag defines which type of data is represented by the value of a property.

The @var tag MUST contain the name of the element it documents. An exception to this is when property declarations only refer to a single property. In this case the name of the property MAY be omitted.

This is used when compound statements are used to define a series of properties. Such a compound statement can only have one DocBlock while several items are represented.

06.12.2016 12:03

@SerializedName

This annotation can be defined on a property to define the serialized name for a property. If this is not defined, the property will be translated from camel-case to a lower-cased underscored name, e.g. camelCase -> camel_case.

06.12.2016 12:03

Arrays

In the previous chapter you had seen that the ‘array’ keyword is supported by phpDocumentor, but this keyword says little about the contents of that array. Usually you have an array with a specific purpose and hence elements of one or at most two different Types.

For phpDocumentor to be able to help you determine which element Types are contained in an array you can declare a Type, such as \DateTime, and suffix it with an opening and closing square bracket. The brackets inform you, and several tools, that this is an array of that Type.

07.12.2016 09:58

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

07.12.2016 09:59

Frameworks, Tools, more: Support of Docker in Remote Interpreters, support of PHPSpec test framework, auto-detection and configuration of PHPUnit, Behat, and PHPSpec, ability to open multiple projects in one frame

07.12.2016 10:01

When we talk about front end performance we think things like concatenation, minification, caching, or gzipping assets on the server so that the page loads faster and users can complete their goals as quickly as possible.

Resource prefetching is another performance enhancing technique. We can use it to tell the browser which assets the user might need in the future—before they even need them.

Pre-fetching is a way of hinting to the browser about resources that are definitely going to or might be used in the future, some hints apply to the current page, others to possible future pages.

As developers, we know our applications better than the browser does. We can use this information to inform the browser about core resources.

07.12.2016 10:02

DNS prefetching

This notifies the client that there are assets we'll need later from a specific URL so the browser can resolve the DNS as quickly as possible. Say we need a resource, like an image or an audio file, from the URL example.com. In the <head> of the document we'd write:

<link rel="dns-prefetch" href="//example.com">

07.12.2016 10:03

Preconnect

Much like the DNS prefetch method, preconnect will resolve the DNS but it will also make the TCP handshake, and optional TLS negotiation. It can be used like this:

<link rel="preconnect" href="http://css-tricks.com">

Modern browsers try their best to anticipate what connections the site will need before the actual request is made. By initiating early "preconnects", the browser can set up the necessary sockets ahead of time and eliminate the costly DNS, TCP, and TLS roundtrips from the critical path of the actual request. That said, as smart as modern browsers are, they cannot reliably predict all the preconnect targets for each and every website.

The good news is that we can — finally — help the browser; we can tell the browser which sockets we will need ahead of initiating the actual requests via the new preconnect hint shipping in Firefox 39 and Chrome 46!

 

07.12.2016 10:04

Prefetching

If we're certain that a specific resource will be required in the future, then we can ask the browser to request that item and store it in the cache for reference later. For example an image or a script, or really anything that's cacheable by the browser:

<link rel="prefetch" href="image.png">

Unlike DNS prefetching, we're actually requesting and downloading that asset and storing it in the cache. However, this is dependent on a number of conditions, as prefetching can be ignored by the browser. For example, a client might abandon the request of a large font file on a slow network. Firefox will only prefetch resources when "the browser is idle".

As Bram Stein explains in his post on the matter, this could have huge performance benefits for webfonts. At the moment, font files have to wait for the DOM and CSSOM to be constructed before they even download. But, if we prefetch them, then that bottleneck can be circumnavigated with ease.

07.12.2016 10:04

In this case the Article is accessed from the entity manager twice, but modified in between. Doctrine 2 realizes this and will only ever give you access to one instance of the Article with ID 1234, no matter how often do you retrieve it from the EntityManager and even no matter what kind of Query method you are using (find, Repository Finder or DQL). This is called “Identity Map” pattern, which means Doctrine keeps a map of each entity and ids that have been retrieved per PHP request and keeps returning you the same instances.

07.12.2016 10:05

Invoking the persist method on an entity does NOT cause an immediate SQL INSERT to be issued on the database. Doctrine applies a strategy called “transactional write-behind”, which means that it will delay most SQL commands until EntityManager#flush() is invoked which will then issue all necessary SQL statements to synchronize your objects with the database in the most efficient way and a single, short transaction, taking care of maintaining referential integrity.

07.12.2016 10:07

Generated entity identifiers / primary keys are guaranteed to be available after the next successful flush operation that involves the entity in question. You can not rely on a generated identifier to be available directly after invoking persist. The inverse is also true. You can not rely on a generated identifier being not available after a failed flush operation.

07.12.2016 10:07

Just like persist, invoking remove on an entity does NOT cause an immediate SQL DELETE to be issued on the database. The entity will be deleted on the next invocation of EntityManager#flush() that involves that entity. This means that entities scheduled for removal can still be queried for and appear in query and collection results. See the section on Database and UnitOfWork Out-Of-Sync for more information.

07.12.2016 10:08

When you want to serialize/unserialize entities you have to make all entity properties protected, never private. The reason for this is, if you serialize a class that was a proxy instance before, the private variables won’t be serialized and a PHP Notice is thrown.

07.12.2016 10:08

If you need to perform multiple merges of entities that share certain subparts of their object-graphs and cascade merge, then you have to call EntityManager#clear() between the successive calls to EntityManager#merge(). Otherwise you might end up with multiple copies of the “same” object in the database, however with different ids.