« first day (1665 days earlier)      last day (3286 days later) » 

3:00 PM
@tereško also when you read data?
 
@marcio 3v4l.org/gBVPe If the error was on line 24, it would be a language change - but the error is on line 5
 
@ziGi sorry, I cannot read your mind. You will have to elaborate
 
Some things that are acceptable as callable, are not in fact callable.
 
user895378
> I don't think we need to RFC that. What we want, is uniformisation and consistency in the way we can call a PHP function from a PHP string. No new idea, no debatte, no RFC needed.
 
user895378
^^ jpauli
 
user895378
3:01 PM
@marcio nothing about that patch suggests the need for an RFC IMO.
 
@tereško when you querry data (so you want to acquire something from the persistence layer) do you create an empty Domain Object, set the query criteria to it and pass it to the Mapper which populates it?
 
@rdlowrey well, that's unfortunate, I'd prefer not to have yet another data structure becoming a callable
 
@marcio sorry, but it already is a callable.
 
If it passes callable you should be able to call it; how is this not a bug fix? It doesn't impact any other code at all.
 
user895378
if (is_callable($callback)) {
    $callback();
}
 
user895378
3:03 PM
^^ that fataling out is a bug. It's not a new feature. If it doesn't work it should be fixed.
 
^ this.
 
^^ you trust PHP to not lie? /s
 
@DanLugg …which one actually errors there? The __invoke?
 
@rdlowrey argh, php is_callable behavior grosses me out - perhaps that's why I'm so biased to not like this "bugfix"
 
3:04 PM
@LeviMorrison Yep. AFAIK
 
but you want an object with default values before it is populated?
 
@iroegbu no
I don't want an object
 
@ziGi yes
 
but because teresko said he does it this way, I was trying to confirm what he's doing
 
$user = new User;
$user->setId(42);
$mapper->fetch($user);
 
3:05 PM
cause what I do is more similar to github.com/J7mbo/silex-auth-skeleton/blob/master/src/App/Model/… but I don't pass a single parameter, but the whole crieria object that I have to the repo
 
@marcio you'd rather break BC and change cuf(a)() and is_callable() ?
 
You know'd be nice? A dedicated type for callable. Fuck strings; strings aren't callable. Fuck arrays; they aren't callable too. They may, in some for represent something callable, but I don't think they should themselves be callable. $f = callable('f'); or $f = callable([$o, 'f'])
 
@tereško Why not $mapper->fetch(new UserId(42));?
@DanLugg Yep; @Andrea have talked a bit about this in this room before.
 
@bwoebi no, I'm just wondering how it affects callable types now
 
However, the best approach is to unify the symbol tables.
 
3:07 PM
>.<
 
callable($arg) : Closure
@LeviMorrison So much agree.
 
I really think we should do it in PHP 8.
 
Or fuck, new Closure($arg)
 
And talk about it soon so there is a LOT of time to prepare.
 
$f = new Closure([$o, 'f'])
 
3:07 PM
@LeviMorrison because mapper is not a factory
 
@tereško I would expect a mapper to map a UserId to a User.
 
he's doing the same thing as you, just passing userId to __construct
 
@LeviMorrison how .. what's the complete API ?
 
@marcio hmm?
 
I just expect "mappers" to "map" things.
 
3:09 PM
to where
 
From one kind to another.
 
you only gave us $mapper->fetch(new UserId(42));
 
Oh, you mean $user = $mapper->fetch(new UserId(42));?
 
there is no "ouput" for this method
@LeviMorrison then I repeat: mapper is NOT a factory
why is it creating User instance ?
 
I wish there were a fallback to properties when invoking class methods
 
3:10 PM
@tereško What does a mapper do if it doesn't map things?
 
mapping != creating
mapper works with something existing
 
map<From,To>(From): To
That's what a definition of a mapping function is, basically.
 
@bwoebi it's yet another detail / language corner to handle for function prototypes - usually when I go against something it's because future RFCs
it's not like I have nothing better to do other than start a war.
 
@LeviMorrison what you have there is NOT a mapper but a factory. Do you really not see it? Your damned mapper are not even able to run in sequence !
 
@tereško if you work with CQRS so basically when you have a Query you get views direcly denormalized, and you don't need domain objects, can't you have something different than a mapper that retrieves the data
 
3:13 PM
@tereško I don't know what terminology you are using here. A mapper, by definition, is something that maps. And to map something is to take something in a given domain and transform it into something in another domain.
2 mins ago, by Levi Morrison
map<From,To>(From): To
^ That, essentially.
 
$sessionMapper->fetch($user);
$sqlMapper->fetch($user);
also, data mapper is not a "mapping function"
and, if you are looking for definition, @LeviMorrison, start here: martinfowler.com/eaaCatalog/dataMapper.html
 
@tereško are there other public functions in your mappers?
 
@tereško A "data mapper" by definition would be something that maps data from one kind to another.
lol
 
@LeviMorrison please READ THE FUCKING post
stop making up definitions based on what "feels right" for you
 
I'm not doing "what feels right for me"
It's the actual mathematical definition
And yes, I will go read the post.
It's by Fowler and I expect it'll be a decent read.
 
3:17 PM
I didn't know there is a Mapper in Mathematics
I though it's related more to structures of data
 
@LeviMorrison unfortunately, we are not talking about math here
 
@tereško Fine. It's the traditional computer science definition.
 
@iroegbu usually only store() .. oh, and sometimes delete(), but it depends on how complex it gets.
 
store is for persisting data?
 
update and insert
 
3:19 PM
okay
 
@tereško Look at this page: martinfowler.com/eaaCatalog/mapper.html
Note that the Pricing Mapper is a map as I defined it.
 
@LeviMorrison strange how it is not describing "data mapper", which we were talking about
almost as if they are different things
 
@tereško Reread the link you gave me and at the bottom it says:
> Since it's a form of Mapper (473
 
@tereško isn't store mixing two responsibilities (create\update) in one method
 
If you are going to pull the "read the **** article" card then you need to read the **** article too.
 
3:21 PM
@ziGi INSERT .. ON DUPLICATE KEY UPDATE
 
@LeviMorrison I understand profanity is **** crude, but given the amount of **** swearing that happens here regularly, I don't **** think it's worth the **** effort to use **** asterisks.
 
@tereško oh, you are working with MySQL
 
@ziGi you can do the same with Postgre
 
@ziGi it doesn't matter where store puts it
 
@DanLugg The difference is that I don't use profanity; I was just quoting him.
 
3:24 PM
just know that mapper() can get it out if store() put it in
 
@LeviMorrison Ah. Carry on then.
 
@LeviMorrison where did it say that it CREATES new things ?
instead of using the existing ones ?
 
@tereško That's irrelevant to the point I made, which is that Pricing Mapper is literally mapping things from one domain to another.
 
no, it is NOT irrelevant
 
Then you are just being naive.
 
3:26 PM
in your example the data mapper is responsible for creating new domain objects
 
@tereško No it's not; it's just responsible for the mapping. It can delegate creating of stuff to something else.
 
$user = $mapper->fetch(new UserId(42));
this create new instance of user
 
And that something can make a new instance or return the same; doesn't matter.
 
And teresko uses a Factory to create his users
 
@tereško Not necessarily.
 
3:28 PM
@LeviMorrison then why is it returning anything ?
 
@DaveRandom the world has gone mad, mmmaaadddddd I say!
 
@tereško Just because it returns something doesn't mean it was created by the same function.
 
@tereško cause UserId is a Value Object and it's immutable
 
20 mins ago, by tereško
@LeviMorrison how .. what's the complete API ?
@ziGi that was not what I was asking
 
@tereško It doesn't matter how; the API is that you give me a UserId and I'll give you a User. That's the point of abstraction; how it is done is hidden.
 
3:30 PM
you have a user with ID 42, how do you populate it
 
tereško's mapper is map<SQL|XML, DO>(SQL): DO
 
And whether it's a new user or an existing one doesn't matter.
 
24 mins ago, by tereško
$user = new User;
$user->setId(42);
$mapper->fetch($user);
this was the complete example of my approach
what is yours @LeviMorrison
 
@tereško I think you can circumvent instantiating domain objects when you do Querries (Reads) since the data can be denormalized in a NoSQL and just return plain data
 
@iroegbu that is completely unrelated
 
3:32 PM
Usually with most apps people make more reads than edits/updates
 
@LeviMorrison it does matter. A lot even, because if you are creating the instance of domain object inside the mapper, then you are not able to use it repeatedly. And your code becomes tightly coupled to the exact way that domain object must be instantiated. And if you are passing in the domain object inside the mapper at some point then the question becomes: why did you need to pass it out again?
Which is why I am asking you to show the complete API for retrieving user's data.
This is NOT about theory but about working code.
@ziGi wat
 
@tereško I didn't say the mapper made a new object. I said it may or may not.
 
@tereško I am talking about this -> martinfowler.com/bliki/CQRS.html
 
28 mins ago, by tereško
@LeviMorrison how .. what's the complete API ?
 
3:37 PM
If you want the property of it reusing existing objects that is completely doable in my API.
 
are you really pulling this out of your arse that you cannot show 2-5 lines of code which illustrates it ?
jeez
 
ARSE!
 
No, @tereško, I'm saying that it could be 5 lines or 20 or 200.
It doesn't matter.
That's the point of abstraction.
 
oh, but it does matter
 
How it does what it does cannot be relied on unless it is in the contract.
 
3:39 PM
you are throwing at me abstract mathematical definitions and I am talking about implementation
 
You are mistaken.
I am talking literally about both.
 
you are showing only one
 
You are miss-taken
 
Anonymous
clash of the titans
 
31 mins ago, by Levi Morrison
Oh, you mean $user = $mapper->fetch(new UserId(42));?
 
3:41 PM
So to clarify, @tereško, you want the property of the same user object being returned given a certain id, yes? So if you ask for user with ID 42 several different times you get the same result, yes?
And by same result we mean the exact same object?
 
without context that example you showed is broken by design
 
@LeviMorrison this is not necessarily true, having in mind that someone else might have changed the persisted data during the multiple requests
 
@ziGi Which is why I'm clarifying.
 
Ah, sorry, I didn't see
 
@tereško I have to go somewhere soon but respond to my clarifying question and I'll respond later.
 
3:43 PM
@LeviMorrison I think that's not exactly true again, since the mapper gets a concrete implementation of an interface, so basically it can be different objects implementing the same interface
 
@LeviMorrison no. The goal is to populate a domain object (user) with data from persistence that matches ID 42
 
What the mapper has is an argument of an interface so the object you give get's populated and is being returned, if you call the mapper twice with different object implementing the interface you would get different results
Am I right, teresko?
 
I am not entirely sure I understood.
$user = new User;
$user->setId(13);
$mapper->fetch($user);
$user->setId(42);
$mapper->fetch($user);
did you mean something like this ?
 
not really more like
$user = new User;
$user->setId(13);
$mapper->fetch($user);
$admin = new Administrator;
$admin->setId(1);
$mapper->fetch($admin);
so basically User and Administrator implement same interface that has setId and some other functions used by the mapper
 
yes, if the interfaces are compatible, then it should work
 
3:49 PM
yep
how do you deal with "search" string criteria which can apply to a multiple Domain Object fields? (for example you want to search the string within the username, email, description)
 
i don't see what's wrong with $user = $mapper->fetch($id); as long as it's idempotent
 
@StefanoTorresi cause the mapper needs to know what object to populate. I guess if you inject a factory in the mapper which creates the object it should be fine.
 
the mapper doesn't need to know the object, just the class. i expect mapper methods to return stuff, not to populate existing stuff with data. that's something that hydrators do, and it doesn't necessarily entails persistence.
 
that's not a mapper
 
of course you can't return a new Object inside a fetch method
i expect $mapper->fetch($id) === $mapper->fetch($id)
 
3:55 PM
a mapper has to map data from somewhere to somewhere...
 
in my case, fetch() and all the other public mapper's methods return a boolean for checking if operation was successful-ish
 
yep, that's what it does, my data is an $id, and i get an object, that's pretty nice mapping to me.
 
@StefanoTorresi what do you do, when there are additional conditions?
 
@StefanoTorresi what do you do when you have 5 different parameters to query by?
haha :D
 
especially in a case of collections
 
3:57 PM
$user = new User;
$user->setEmail('a@b.com');
$mapper->fetch($user);
 
that's up to how you want to design your interface
 
@StefanoTorresi my point is that if your mapper is creating objects, then it becomes a factory builder
 
my mapper is not creating a thing, you don't know what it does, it just returns what i want.
 
@tereško how do you deal with the situation when you have a search string as an input which should be used to find users that have this string as part of their username, description, email (lets say)
 
$colection = new UserCollection;
$collection->setCondition($whatever);
$collectionMapper->fetch($collection);
 
3:59 PM
	if (preg_match("((?:^|;)\s*limit\s*=\s*([^;]*?)\s*(?:;|$))is", $str, $match, PREG_OFFSET_CAPTURE)) {
		$limit = $match[1][0];
		$str = substr_replace($str, ";", $match[0][1], strlen($match[0][0]));
	}
^ Does anyone have a better way to do the above?
 
do you have a special "search" variable inside the domain object?
 
@ziGi no, that's what the collections are for
 
still don't like it. and you're not actually mapping anything. i can't see different data formats being mapped.
 
@bwoebi what exactly is that black magic doing ?
 
@StefanoTorresi that's the idea
 
4:01 PM
@tereško removing the limit option from a string and getting its value (string in form of opt1 = str; limit = 1234 ; dumdidum = 19)
 
@ziGi stackoverflow.com/a/11943107/727208 kinda like described here
 
@tereško hence I ask for a more idiomatic way to do this which doesn't involve complete exploding, full array search and re-imploding
 
@tereško i'd rather do something more doctrine-ish, i.e. $collection = $mapper->findBy($criteria)
 
4 mins ago, by tereško
@StefanoTorresi my point is that if your mapper is creating objects, then it becomes a factory builder
@bwoebi yeah .. i would have just exploded that one =/
 
posted on May 08, 2015 by kbironneau

/* by tecnowilliam */

 
4:03 PM
@tereško you keep reapeating that, ignoring the fact that a mapper just takes data in and returns data out. what's being created in the meanwhile is none of the consumer concern.
 
@tereško first try… ended up with something like 12 lines
it wasn't really nice.
 
@StefanoTorresi you keep assuming that mapper returns data
it doesnt
 
You have 12 lines right now, it's just hidden in a regex...
 
@bwoebi I would just remove spaces and explode .. then unset ['limit'] and implode
 
4:06 PM
@tereško did you actually read PoEAA or you just fancy linking it to show off?
every implementation in the book has methods that actually return stuff.
you are hydrating object with data, not mapping one data format to another.
furthermore, returning booleans is generally an idea i wouldn't support. exceptions are there, use them. i want data returned from the persistence abstraction, not success flags.
 
@tereško jup, when you explode ($exp = explode(";", $str); foreach ($exp as $cur => $pair) { list($key, $value) = explode("=", trim($pair), 2); if (trim($key) == "limit") { $limit = trim($value); unset($exp[$cur]); } } $str = implode(";", $str);) … moaaaah… okay. Just 9 lines, but still.
 
@StefanoTorresi Wait, you are proposing exceptions for flow control?
 
@StefanoTorresi emm .. wut
jeez, now I need to find a tracker where to download PoEAA
 
@Jimbo not at all
 
gawd, why did the damned laptops hdd die
 
4:19 PM
@Jimbo This is a tedious conversation, and the discussion about returning null or throwing an exception is also tedious, but the TL:DR version is that there is a fundamental difference between getById and findBy*** functions and that some people (including myself) think that getById functions should throw exceptions: chat.stackoverflow.com/transcript/11?m=21287625#21287625
 
@tereško so if you have to use a string to search for users that have it in either their name or email or description, you will set the same string in those three properties of the DO and give the DO to the mapper?
 
no
 
What would you do then?
 
@Danack to clarify i'm not talking about throwing an exception if the mapper failed to find results, i'm talking about throwing exceptions in case the persistence layer failed, which should be indeed an exceptional event.
 
@StefanoTorresi what happens if mapper fails to find result?
 
4:24 PM
@iroegbu it boils down to personal preference, some like throwing an exception, i'd rather return an empty result set or null. neither is right or wrong. certainly no "success flag" is involved though.
 
/** @return User|null|-1|false|[true&false]|Retardation[] */
4
 
@ziGi when you are doing a search, you do not expect a single result but a list of them. That's why you work with a collection of domain objects. A collection contains the initial condition and, after mapping, a list of domain objects
 
27 mins ago, by tereško
$colection = new UserCollection;
$collection->setCondition($whatever);
$collectionMapper->fetch($collection);
 
// if you collection implements iterator
foreach ($collection as $user) {
    echo $user->getName():
}
 
@Jimbo false|[true&false] … uuuh?
 
4:29 PM
@bwoebi I was being facetious :P
 
yeah , it should have been ['insert' => true & 'update' => false]
=)
 
are you trying to have literals as return types? function(): "a"|"b"|"c" {} oh boy
 
.. well, today I discovered one thing taht will be a pain to recover: my book collection
 
is there some kind of advanced search on bugs.php.net?
 
4:44 PM
@tereško first time I see people hunting using eagles. That must be the most American thing ever
 
@marcio You mean other than the one you get by clicking 'advanced search' ? bugs.php.net/search.php
Or were you hoping for a decent one? As Bugzilla suuuuccks.
 
@Danack thanks, I was expecting such a feature to be on the navigation bar
heh, it is
it doesn't suck that much, the options I need are there just not very eye pleasant
 
@ziGi it's not American
 
5:13 PM
Bird, go get mi some food, now!
in the case of the video we saw, the query failed with Unable to retrieve rabbit exception because of jumping
 
5:30 PM
Holy fuck. I never knew we had a \R in php
TIL
 
@PeeHaa you mean carriage return?
 
Yeah. I have never known this :|
Well not carriage return is it?
Doesn't it also handle line feeds?
 
\r = Mac OS old school carriage return
\n = Unix Newline
\r\n = Microsoft mishmash
 
Mac doesn't do that
It used to be \r but that is a loooong time ago
 
@PeeHaa Sorry, OS9 and earlier do
 
5:36 PM
You're old :P
@bwoebi Yeah \R does it all
 
My Computer Science professor was a Mac nut. So in using Macs to write for Linux use I had to convert those :/
 
inserts magic meme
 
5:57 PM
Hi all. Whats the best way to build real time chat. The chat similar to this SO. using PHP
 
There is no best way
 
@PeeHaa most efficient way
 
Most efficient would be to drop the php requirement me thinks
 
you mean moving to another plateform?
 
@tereško Simple: first map a User to an Id. Then use the process I mention before, and take that result and copy it into the original User.
Another question for you: what if there is no user by that ID?
What do we populate the object with?
 
6:04 PM
@Kannu Yeah
Otherwise you could give socketo.me a try
 
@PeeHaa what about php with xmpp
 
What about it?
 
What do people have against node.js
 
Besides it's javascript. Not much
 
for node.js we need dedicated server
 
6:07 PM
@PeeHaa this still feels like my fathers Internet… I need Aerys!
 
it cannot be run on shared hosting, thats it
 
Why would someone use shared hosting?
 
@bwoebi Is it actually released yet?
 
@iroegbu we all use
 
@Kannu there's no shared hosting where you ever could run your own daemon which you'd need for websockets…
 
6:08 PM
else its very expensive
 
@PeeHaa Only issue :-P
 
:-)
 
By Joe's calculation cost of VS < cost for 1 cup of coffee daily for a year
 
@Kannu WHat is expensive?
 
@PeeHaa Daniel is currently doing what I believe the last major refactor…
 
6:09 PM
dedicated hosting
 
@bwoebi So between 1 and 2 years ?
 
@PeeHaa can we run node.js apps on shared hosting?
 
@Kannu A VPS is dirt cheap
 
@Kannu a vserver… is like 5€/month.
 
@Kannu Doubt it
 
6:10 PM
@PeeHaa a major refactor is usually 3-5 months
(with 2-4 months him doing everything but Aerys…)
I believe I'll see the next iteration in one week according to his current speed…
 
@bwoebi Well I believe it when I see it :P
 
@PeeHaa yeah… let's see when Aerys is ready for alpha access :-)
 
@marcio If you consider that a Boolean is often defined like this in functional languages:
type Bool = False | True;
Then False and True are also types, of which there are only one value of each (False and True respectively)
(this is because their type constructors accept no parameters, therefore they will always be the same)
 
just like our null…
 
Correct.
Functional programming is straightforward in that it usually directly follows established type theory.
The hard part about functional languages is they generally use drastically different syntax from what we are used to.
5
Commas? Why do you need those? Just use whitespace…
Parenthesis on every function application? Why not only if there needs to be a resolved ambiguity?
 
6:17 PM
@LeviMorrison you mean whitespaces?
 
Let's model IO as a type!
And so on.
 
@LeviMorrison How would that work? :o
 
@bwoebi That's one part I don't really understand. Yet.
 
:-(
 
6:39 PM
Lol
 
Hi guys) I wonder, do some of you have own startups?)
 
Some people have their own business, if that's what you mean. If you mean do people here have VC money.....probably not.
 
6:54 PM
@Danack what is VC money?
 
Venture capital - aka what funds a lot of 'start ups'.
 
@Danack ah you mean that type of businesses that get started by a random marketing guy ^^
venture capital.. I would never...
 
No....most VC funded stuff is a bunch of techies.
 

« first day (1665 days earlier)      last day (3286 days later) »