Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


ignace last won the day on May 14 2018

ignace had the most liked content!

Community Reputation

196 Excellent

About ignace

  • Rank
    Prolific Member
  • Birthday 09/05/1986

Profile Information

Recent Profile Visitors

27,474 profile views
  1. Thanks @oni-kun. Good observation about the pattern. I will look into that.
  2. Thank you @requinix. I am afraid it probably is the last one.
  3. 9M[bfv�����������"2<I=0L_nt���������+8@,IOPG:e~��������������$0<(4@LXdp|���������� ,8$0<HT`lx������ �63PQWa,MFk^����ʺ�������$08(4@LXdp|���������� ,8$0<HT`lx��������2D=ZWtU[ePrj������������$0<(4<LXdp|���������� ,8$0<HT`lx����������=Vha^[xy�t�����������$0<(4@LX`p|���������� ,8$0<HT`lx�����������(0BG:x��������������$0<(4@LXdp|���������� ,8$0<HT`lx��������>ENI4@,8DP\ht�����������$0<(4@LXdp|���������� ,8$08Job�������������(4<,8DP\ht�����������$0<(4@LXdp|��������#�Z`j6@<HT`lx�����������(4@,8DP\ht�����������$0<(4@LX`r����������� ,8$0<DT`lx��������
  4. I am looking for someone that can help me optimize an InnoDB/MariaDB server. There are a few issues that the current server has that I would like someone to have a look at. If you are interested send your resume and hourly and daily rate to innodb-application@cogito.website Put PHPFreaks & InnoDB in the e-mail subject. Thank you.
  5. Okay, let's try something simpler. Say you have this code: <?php declare(strict_types=1); // .. public function setAge(int $age) { $this->age = $age; } Passing a string to this method will throw an exception. The form processing code should validate that the age is indeed a number before passing it to your setAge() method. You can't start accepting "Dave", TRUE, ['foo']['bar'] = 'bat' as age. What I said above is basically the same thing. You protect your model from invalid data. If the business you are writing this software for has other rules, like must be over the age
  6. Yes, your form and any other client-side code should have validation that checks that all business rules (being 18+) have been enforced. Validation and exceptions are not the same thing. Validations are done before you pass it down. While exceptions are thrown after it has been passed down and is invalid. Because your model sits at the center of your application and is guarded with exceptions it becomes impossible to use them with invalid data. Which makes your life as a developer much easier. And anything you add on top adds it's own validation and has it's own method of commun
  7. Entities should not have error messages, they should throw exception's on invalid input. Error messages are to indicate to the user that what he input is invalid. Why exceptions? Because your model must be a source of truth, it enforces the business rules. The application (forms, buttons, ui) lies on top of your model. So for the application to communicate effectively with the model it must ensure all input is valid BEFORE the model is called. The exception's are usually called like this in the model: <?php public function setBirthDate(DateTimeInterface $dt) { $this-&g
  8. 1) Let the view do a sub-request to the header controller to load the menu. 2) Create a view helper that loads the menu. Both will require the current route to determine which hierarchy to load/show.
  9. If you have a monetary income in any officially recognized currency*, you need to pay tax! It's that simple, really. Now it's possible that certain income is exempt from tax, for example, a yearly turn-over less then 5.000 individually, or 25.000 as a business. That's the current law in Belgium. I am not an accountant, and I am unfamiliar with tax regulations in Australia. If you have a business, it's recommended to have an accountant, he'll advise you on the best approach, and keep your taxes in check. *So anything not monetary, or any unofficial currency, would be tax-free. Get pa
  10. Nope, they don't. At least not in my case, others may have had better luck. I was only joking when I said that. I am already happy if I get a thumbs up on my answers.
  11. Admin seems more like a privilege/role, so I would make that a field of User. Then your User and Person. I get what you are saying, and I have this in my system. I would have a Person object with no reference to a User. And let the User reference Person. Thus decoupling my application from the auth layer. <?php class User { const ROLE_SYSTEM = 'role_system'; const ROLE_ADMIN = 'role_admin'; /** * @var string[] */ private $roles = [ ]; /** * @var Person|null */ private $person; } For system accounts, the Person reference would be NULL as it's not requir
  12. And after you started using the power sander, how often have you done it by hand since? And if given the chance to do it by hand, would you still do it? Regardless of the fact that these are apples and oranges. If done by hand or machine delivers about the same end-product. Regardless with which you started or ended. You can start by hand, go to the machine, and finish by hand. Also the work still has to be done, to get the final product. This is not the case in software development. You would basically pick up an already sanded object of any length and any given size in an infi
  13. Events are a good way to extend your code without adding unnecessary dependencies. A ghost copy is a class with only it's ID filled in. Personally I avoid writing things that have been written before and rather build upon them. In the long run of an application you get burned by the "not invented here" syndrome. I have seen it over and over, and over again.
  14. What requinix said, and to reduce unnecessary: querying, hydrating, etc.. for what is essentially throwing something into the bin. And it still allows your mapper to fire off any associated events, if there would be any. Another option would be to use a ghost copy, and drop the deleteOneById. But that depends on how you architect your software. Since a DELETE is the opposite of a SELECT. You can create any "query" methods for it: deleteAllByCompanyName(string $companyName); Internally they do the same thing as with the deleteOneById. They query and store any ID's sch
  15. For a Data Mapper this is mixed. Since your mapper maps from and to the database. You would need to be able to use several types of input to get what you need. <?php interface UserMapper { function findOneById(int $id): ?User; function findAllById(array $id): ?UserCollection; function findOneByUsernameAndEmail(string $username, string $email): ?User; function findAllRegisteredBetween(DateTimeInterface $start, DateTimeInterface $end): ?UserCollection; function findAllRecentlyRegistered(DateTimeInterface $currentDate): ?UserCollection; function create(User $user): void;
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.