Mvc\Collection::createIfNotExist

public createIfNotExist (array $criteria)

Creates a document based on the values in the attributes, if not found by criteria Preferred way to avoid duplication is to create index on attribute $robot = new Robot(); $robot->name = “MyRobot”; $robot->type = “Droid”; //create only if robot with same name and type does not exist $robot->createIfNotExist( array( “name”, “type” ) );

doc_Phalcon
2016-10-16 09:52:12
Comments
Leave a Comment

Please login to continue.