9 Matching Annotations
  1. Nov 2019
    1. Instead of using the empty_data option – which is only called if we create an object, but not if we update it – we will implement a custom data mapper. Symfony's data mappers are responsible for mapping the data of a form to its fields and back. For our MoneyType, Symfony's default data mapper will call the following methods when we display a form with an existing Money instance: $form->get('amount')->setData($money->getAmount()); $form->get('currency')->setData($money->getCurrency()); The properties of the Money are copied to the form simply by calling the appropriate getters. When we submit the form, the data mapper inverts that behavior: $money->setAmount($form->get('amount')->getData()); $money->setCurrency($form->get('currency')->getData()); That's where the data mapper fails. The setters setAmount() and setCurrency() don't exist. To create a custom data mapper we need to implement DataMapperInterface. Let's look at this interface: namespace Symfony\Component\Form; interface DataMapperInterface { /** * Maps properties of some data to a list of forms. * * @param mixed $data Structured data. * @param FormInterface[] $forms A list of {@link FormInterface} instances. */ public function mapDataToForms($data, $forms); /** * Maps the data of a list of forms into the properties of some data. * * @param FormInterface[] $forms A list of {@link FormInterface} instances. * @param mixed $data Structured data. */ public function mapFormsToData($forms, &$data); } These methods correspond to the two previous code blocks. The method mapDataToForms() calls setData() on all passed forms by reading the passed $data. Conversely, mapFormsToData() updates $data by reading the data of the passed forms.

      This is so important & useful, when working in DDD & immutability, where setters are avoided.

  2. Oct 2019
    1. This can become messy when you have a lot of configurations in your Entity. Another issue is that your annotations are coupled to your source code. Your database implementations details, or any other configurations are coupled to your domain object. This goes against the guidelines of clean code. Your domain object (Entity) should only have one reason to change.

      Thank you for saying that loud.

  3. Jun 2019
    1. the doctrine of sunk costs

      when you choose to evaluate the value of an item based on what they can do for you in the future no matter how much value they cost originally.

  4. Feb 2019
    1. hound up in human reason. pas­sion, and imagination; that human beings function in social groups an<l arc limited by historical circumstances

      Sounds like the human-measure doctrine and casuistry. Vico = 18th C sophist. He's a bit dour, though:

  5. Jan 2019
    1. we are partofthe worldin its ongoing intra-activity

      This brings to mind Protagoras's human-measure doctrine. The only way to know the world is through the lens of our humanity; we are inherently part of the world and are literally unable to remove ourselves from it in order to see it any other way.

  6. Apr 2018
    1. So far it is from being true, that a bill of rights is less necessary in the general constitution than in those of the states, the contrary is evidently the fact. — This system, if it is possible for the people of America to accede to it, will be an original compact; and being the last, will, in the nature of things, vacate every former agreement inconsistent with it. For it being a plan of government received and ratified by the whole people, all other forms, which are in existence at the time of its adoption, must yield to it. This is expressed in positive and unequivocal terms, in the 6th article, “That this constitution and the laws of the United States, which shall be made in pursuance thereof, and all treaties made, or which shall be made, under the authority of the United States, shall be the supreme law of the land; and the judges in every state shall be bound thereby, any thing in the constitution, or laws of any state, to the contrary notwithstanding.

      Would probably try to address the following w/ my students. Was Brutus correct (in either the short term or the long run)? Did this clause of the Constitution supersede or usurp state gov't authority? If so, specific historical examples and or Supreme court precedent cases??